/* This dofile is to build a dataset of students at baseline */

clear all
capture log close
set more off
set varabbrev off

log using "$logfile/build_grade1112_$date.log", replace


********************************************************************************
*
*						 AUGUST 19 DATASETS 
*
********************************************************************************	

import delimited "$raw/student/grade1112/20210918121644-SurveyExport.csv", clear

**************** DATA PROCESSING ***********************************************
* Personal information
cap ren whatisyourname name
cap ren whatisyourgender sex
replace sex=0 if sex==2
lab define sex 0 "Female" 1 "Male" 
lab val sex sex 
cap ren inwhichdzongkhagisyourschoolloca district
cap ren whatisthenameofyoursecondaryscho schoolname
cap ren dateofbirthdaywhatisyourdateofbi b_day
cap ren dateofbirthmonthwhatisyourdateof b_month
cap ren dateofbirthyearwhatisyourdateofb b_year
cap ren whatisyourstudentidcode studentid
cap ren whatisyouremailaddressprovidedby email
cap ren whatisyourprivateemailaddress email2
cap ren whatisyourmobilephonenumber phone
cap ren whichdzongkhagareyouoriginallyfr district_origin
tostring district_origin, replace
replace district_origin="Bumthang" if district_origin=="1"
replace district_origin="Chukha" if district_origin=="2"
replace district_origin="Dagana" if district_origin=="3"
replace district_origin="Gasa" if district_origin=="4"
replace district_origin="Haa" if district_origin=="5"
replace district_origin="Lhuentse" if district_origin=="6"
replace district_origin="Mongar" if district_origin=="7"
replace district_origin="Paro" if district_origin=="8"
replace district_origin="Pema Gatshel" if district_origin=="9"
replace district_origin="Punakha" if district_origin=="10"
replace district_origin="Samdrup Jongkhar" if district_origin=="11"
replace district_origin="Samtse" if district_origin=="12"
replace district_origin="Sarpang" if district_origin=="13"
replace district_origin="Thimphu" if district_origin=="14"
replace district_origin="Tashigang" if district_origin=="15"
replace district_origin="Tashi Yangtse" if district_origin=="16"
replace district_origin="Trongsa" if district_origin=="17"
replace district_origin="Tsirang" if district_origin=="18"
replace district_origin="Wangdue Phodrang" if district_origin=="19"
replace district_origin="Zhemgang" if district_origin=="20"
replace district_origin="Phuentsholing Thromde" if district_origin=="21"
replace district_origin="99" if district_origin=="Don"

cap ren whatisyouracademicstream stream 

* Perception about education and employment
cap ren itisimportantformetoreceiveeduca b1a
cap lab var b1a "perception: it's important to receive education"
cap ren educationhelpsmegetabetterjobhow b1c
cap lab var b1c "perception: education helps me get a better job"

cap ren scienceandtechnologyaremakingour b2a
cap lab var b2a "perception: science makes lives healthier, easier, comfortable"
cap ren allthingsconsideredscienceandtec b2d 
cap lab var b2d "perception: science makes the world better off"

* Academic performance
cap ren mathwhatisyouracademicperformanc c1a
cap lab var c1a "performance: math"
cap ren dzongkhawhatisyouracademicperfor c1b
cap lab var c1b "performance: dzongkha"
cap ren englishwhatisyouracademicperform c1c
cap lab var c1c "performance: english"
cap ren physicswhatisyouracademicperform c1d 
cap lab var c1d "performance: physics"
cap ren chemistrywhatisyouracademicperfo c1e
cap lab var c1e "performance: chemistry"
cap ren biologywhatisyouracademicperform c1f
cap lab var c1f "performance: biology"
cap ren economicswhatisyouracademicperfo c1g
cap lab var c1g "performance: economics"
cap ren geographywhatisyouracademicperfo c1h
cap lab var c1h "performance: geography"
cap ren historywhatisyouracademicperform c1i
cap lab var c1i "performance: history"
cap ren ictwhatisyouracademicperformance c1j
cap lab var c1j "performance: ICT"
cap ren overallwhatisyouracademicperform c1k
cap lab var c1k "performance: overall"

* TVET courses in high school
cap ren haveyoutakenanytvetoptionalcours c2
cap lab var c2 "taken any TVET optional course?"
cap lab def tvet 1 "Yes" 2 "No"
cap lab val c2 tvet

cap ren animationwhichtvetoptionalcourse c3a
cap lab var c3a "tvet course taken: animation"
cap ren automobilemechanicwhichtvetoptio c3b 
cap lab var c3b "tvet course taken: automobile mechanic"
cap ren computerhardwareandnetworkingwhi c3c
cap lab var c3c "tvet course taken: computer hardware, networking"
cap ren electricalwhichtvetoptionalcours c3d
cap lab var c3d "tvet course taken: electrical"
cap ren furnituremakingwhichtvetoptional c3e
cap lab var c3e "tvet course taken: furniture"
cap ren heavyearthmoverwhichtvetoptional c3f
cap lab var c3f "tvet course taken: heavy earth mover"
cap ren heavyvehicledrivingwhichtvetopti c3g
cap lab var c3g "tvet course taken: heavy vehicle driving"
cap ren jimzowhichtvetoptionalcoursehave c3h
cap lab var c3h "tvet course taken: jimzo"
cap ren lhadriwhichtvetoptionalcoursehav c3i
cap lab var c3i "tvet course taken: lhadri"
cap ren masonrywhichtvetoptionalcourseha c3j
cap lab var c3j "tvet course taken: masonry"
cap ren mechanicalfitterwhichtvetoptiona c3k
cap lab var c3k "tvet course taken: mechanical fitter"
cap ren panelbeatingdentingandpantingwhi c3l
cap lab var c3l "tvet course taken: panel beating"
cap ren patrawoodcarvingwhichtvetoptiona c3m
cap lab var c3m "tvet course taken: patra"
cap ren plumbingwhichtvetoptionalcourseh c3n
cap lab var c3n "tvet course taken: plumbing"
cap ren repairmaintenanceandcommissionin c3o
cap lab var c3o "tvet course taken: repair, maintenance"
cap ren hotelortourismmanagementwhichtve c3p
cap lab var c3p "tvet course taken: hotel, tourism management"
cap ren foodproductionwhichtvetoptionalc c3q
cap lab var c3q "tvet course taken: food production"
cap ren tailoringwhichtvetoptionalcourse c3r
cap lab var c3r "tvet course taken: tailoring"

cap ren whydidyounotchoosetotaketvetopti c4
cap lab var c4 "reason not taking tvet course"

* Mentoring
cap ren parentsdoyoutalktoaboutyourcaree c5c1
cap lab var c5c1 "mentoring: parents"
cap ren brotherssistersdoyoutalktoabouty c5c2
cap lab var c5c2 "mentoring: siblings"
cap ren otherrelativesdoyoutalktoaboutyo c5c3
cap lab var c5c3 "mentoring: relatives"
cap ren friendsdoyoutalktoaboutyourcaree c5c4
cap lab var c5c4 "mentoring: friends"
cap ren neighborsdoyoutalktoaboutyourcar c5c5
cap lab var c5c5 "mentoring: neighbors" 
cap ren teachersorschoolcounselordoyouta c5c6
cap lab var c5c6 "mentoring: teachers school counselors"
cap ren othersdoyoutalktoaboutyourcareer c5c7 
cap lab var c5c7 "mentoring: others"

forval i=1/7 {
	cap replace c5c`i'="1" if ~missing(c5c`i')
	destring c5c`i', replace
	cap replace c5c`i'=0 if c5c`i'==.
}

* Education plans
cap ren iftherewerenobarriershowfarinsch c7
cap lab var c7 "education plan if no barriers"
cap ren asthingsstandnowhowfarinschooldo c8 
cap lab var c8 "education plan as things stand now"

* Preference about employment 
cap ren incomeforyourfutureeducationalan d1a
cap lab var d1a "importance to educareer: income"
cap ren prestigeandsocialstatusforyourfu d1c
cap lab var d1c "importance to educareer: prestige"
cap ren mygenuineinterestforyourfutureed d1d
cap lab var d1d "importance to educareer: genuine interest"
cap ren advicefromparentsorguardiansfory d1f
cap lab var d1f "importance to educareer: parents advice"
cap ren whatmyfriendsthinkandchooseforyo d1g
cap lab var d1g "importance to educareer: friends choice"
cap ren goodbalancebetweenprofessionalan d1h
cap lab var d1h "importance to educareer: worklife balance"
cap ren costsofeducationforyourfutureedu d1i
cap lab var d1i "importance to educareer: costedu"

cap ren agricultureforestryandfishingwhi d2a
cap lab var d2a "ranking perferred sector: agriculture"
cap ren miningwhichsectorswouldyouprefer d2b
cap lab var d2b "ranking perferred sector: mining"
cap ren manufacturingwhichsectorswouldyo d2c
cap lab var d2c "ranking perferred sector: manufacturing"
cap ren electricitygaswatersupplywastema d2d
cap lab var d2d "ranking perferred sector: public utilities"
cap ren constructionwhichsectorswouldyou d2e
cap lab var d2e "ranking perferred sector: construction"
cap ren retailwholesaletradingwhichsecto d2f
cap lab var d2f "ranking perferred sector: trade"
cap ren hotelrestaurantfoodserviceswhich d2g
cap lab var d2g "ranking perferred sector: hotel, food"
cap ren transportationwhichsectorswouldy d2h
cap lab var d2h "ranking perferred sector: transportation"
cap ren informationandcommunicationwhich d2i
cap lab var d2i "ranking perferred sector: ict"
cap ren financialandinsuranceactivitiesw d2j
cap lab var d2j "ranking perferred sector: finance"
cap ren educationwhichsectorswouldyoupre d2k
cap lab var d2k "ranking perferred sector: education"
cap ren healthwhichsectorswouldyouprefer d2l
cap lab var d2l "ranking perferred sector: health"
cap ren entertainmentartsrecreationwhich d2m
cap lab var d2m "ranking perferred sector: entertainment"
cap ren professionalscientificandtechnic d2n
cap lab var d2n "ranking perferred sector: science"

cap ren governmentwhichofthefollowingemp d3a
cap lab var d3a "ranking preferred employer: government"
cap ren governmentownedcorporationwhicho d3b
cap lab var d3b "ranking preferred employer: soe"
cap ren privatecompanywhichofthefollowin d3c
cap lab var d3c "ranking preferred employer: private"
cap ren runningnonfarmingbusinesswhichof d3d
cap lab var d3d "ranking preferred employer: own nonfarm"
cap ren farmingwhichofthefollowingemploy d3e
cap lab var d3e "ranking preferred employer: own farm"

cap ren iknowexactlywhichoccupationiwant d4a
cap lab var d4a "perception: know exactly which occupation to work"
cap ren bluecollarjobsarepoorlyperceived d4c
cap lab var d4c "perception: blue-collar jobs are poorly perceived in society"
cap ren bluecollarjobsareinferiortowhite d4d
cap lab var d4d "perception: blue-collar jobs are inferior to white collars"
cap ren evenwithgoodpayiwouldnttakebluec d4e
cap lab var d4e "perception: even with good pay, not take blue-collar jobs"
cap ren bluecollarjobsareformenrathertha d4g
cap lab var d4g "perception: blue-collar jobs are for men than women"

* Knowledge about university education and TVET education
cap ren universityeducationhowmuchdoyoua f1a
cap lab var f1a "knowledge: admission criteria to university"
cap ren tveteducationbytechnicaltraining f1b
cap lab var f1b "knowledge: admission criteria to tvet"

cap ren v271 f2a
cap lab var f2a "knowledge: application to university"
cap ren v272 f2b
cap lab var f2b "knowledge: application to tvet"

cap ren v273 f3a
cap lab var f3a "knowledge: curriculum of university"
cap ren v274 f3b
cap lab var f3b "knowledge: curriculum of tvet"

cap ren v275 f4a
cap lab var f4a "knowledge: student life at university"
cap ren v276 f4b
cap lab var f4b "knowledge: student life at tvet"

cap ren v277 f5a
cap lab var f5a "knowledge: tuition scholarship university"
cap ren v278 f5b
cap lab var f5b "knowledge: tuition scholarship tvet"

cap ren v279 f6a
cap lab var f6a "knowledge: graduation rate of university"
cap ren v280 f6b
cap lab var f6b "knowledge: graduation rate of tvet"

cap ren v281 f7a
cap lab var f7a "knowledge: future career of university"
cap ren v282 f7b
cap lab var f7b "knowledge: future career of tvet"

cap ren v283 f8a
cap lab var f8a "knowledge: overall university"
cap ren v284 f8b
cap lab var f8b "knowledge: overall tvet"


* Degree ranking by genuine interest 
cap ren bachelorssciencemathcomputerscie f9a
cap lab var f9a "ranking: SCI"
cap tostring f9a, replace 
cap ren bachelorsengineeringpleaserankth f9b
cap lab var f9b "ranking: ENG"
cap tostring f9b, replace 
cap ren bachelorsmedicinehealthandnursin f9c
cap lab var f9c "ranking: MED"
cap tostring f9c, replace 
cap ren bachelorseducationpleaserankthef f9d
cap lab var f9d "ranking: EDU"
cap tostring f9d, replace 
cap ren bachelorsbusinessmanagementecono f9e
cap lab var f9e "ranking: BUS"
cap tostring f9e, replace 
cap ren bachelorsartshumanitiesandsocial f9f
cap lab var f9f "ranking: ARTS"
cap tostring f9f, replace 
cap ren technicaldegreesnationalcertific f9g
cap lab var f9g "ranking: TTI"
cap tostring f9g, replace 
cap ren stopeducationafterhighschoolplea f9h
cap lab var f9h "ranking: HighSchool"
cap tostring f9h, replace 

* Based on academic performance, how difficult to enroll/complete
cap ren bachelorsdegreesbasedonyouracade f10a
cap lab var f10a "how difficult to enroll in university"
cap ren v294 f10b
cap lab var f10b "how difficult to enroll in tvet"

cap ren bachelorsdegreeshoweasyordifficu f11a
cap lab var f11a "how difficult to complete university"
cap ren v296 f11b
cap lab var f11b "how difficult to complete tvet"

cap ren bachelorsdegreeshowmuchdoyouthin f12a
cap lab var f12a "how much to enjoy curriculum of university"
cap ren v298 f12b
cap lab var f12b "how much to enjoy curriculum of tvet"

cap ren v299 f13a
cap lab var f13a "how much to enjoy student life of university"
cap ren v300 f13b
cap lab var f13b "how much to enjoy student life of tvet"

* Decision today 
cap ren v301 f14a 
cap lab var f14a "decision ranking: SCI"
cap ren bachelorsengineeringifyoutodayde f14b
cap lab var f14b "decision ranking: ENG"
cap ren v303 f14c
cap lab var f14c "decision ranking: MED"
cap ren bachelorseducationifyoutodaydeci f14d
cap lab var f14d "decision ranking: EDU"
cap ren v305 f14e
cap lab var f14e "decision ranking: BUS"
cap ren v306 f14f
cap lab var f14f "decision ranking: ARTS"
cap ren v307 f14g
cap lab var f14g "decision ranking: TTI"
cap ren stopeducationafterhighschoolifyo f14h
cap lab var f14h "decision ranking: HS"

* Sure about f14?
cap ren howsureareyouaboutyourchoicesand f15
cap lab var f15 "How sure about f14"

* Understand questions 
gen attentiveness = 1 if ifyouunderstandtheinstructioncle==2
lab var attentiveness "student understands the questions well"

*  Beliefs about % of other students choice
cap ren v310 f16a_m
cap lab var f16a_m "belief: % male students choosing SCI"
cap ren bachelorsengineeringwhatpercenta f16b_m
cap lab var f16b_m "belief: % male students choosing ENG"
cap ren v312 f16c_m
cap lab var f16c_m "belief: % male students choosing MED"
cap ren bachelorseducationwhatpercentage f16d_m
cap lab var f16d_m "belief: % male students choosing EDU"
cap ren v314 f16e_m
cap lab var f16e_m "belief: % male students choosing BUS"
cap ren v315 f16f_m
cap lab var f16f_m "belief: % male students choosing ARTS"
cap ren v316 f16g_m
cap lab var f16g_m "belief: % male students choosing TTI"
cap ren stopeducationafterhighschoolwhat f16h_m
cap lab var f16h_m "belief: % male students choosing HS"

cap ren v318 f16a_f
cap lab var f16a_f "belief: % female students choosing SCI"
cap ren v319 f16b_f
cap lab var f16b_f "belief: % female students choosing ENG"
cap ren v320 f16c_f
cap lab var f16c_f "belief: % female students choosing MED"
cap ren v321 f16d_f
cap lab var f16d_f "belief: % female students choosing EDU"
cap ren v322 f16e_f
cap lab var f16e_f "belief: % female students choosing BUS"
cap ren v323 f16f_f
cap lab var f16f_f "belief: % female students choosing ARTS"
cap ren v324 f16g_f
cap lab var f16g_f "belief: % female students choosing TTI"
cap ren v325 f16h_f
cap lab var f16h_f "belief: % female students choosing HS"

* TVET courses 
cap ren animationifyouenrollinatvetinsti f17a
cap lab var f17a "how interesting if enroll TVET: animation"
cap ren automobilemechanicifyouenrollina f17b 
cap lab var f17b "how interesting if enroll TVET: automobile"
cap ren computerhardwareandnetworkingify f17c 
cap lab var f17c "how interesting if enroll TVET: computer"
cap ren electricalifyouenrollinatvetinst f17d
cap lab var f17d "how interesting if enroll TVET: electrics"
cap ren furnituremakingifyouenrollinatve f17e
cap lab var f17e "how interesting if enroll TVET: furniture"
cap ren heavyearthmoverifyouenrollinatve f17f
cap lab var f17f "how interesting if enroll TVET: heavy earth mover"
cap ren heavyvehicledrivingifyouenrollin f17g
cap lab var f17g "how interesting if enroll TVET: heavy vehicle drive"
cap ren jimzoifyouenrollinatvetinstituti f17h
cap lab var f17h "how interesting if enroll TVET: jimzo"
cap ren lhadriifyouenrollinatvetinstitut f17i
cap lab var f17i "how interesting if enroll TVET: lhadri"
cap ren masonryifyouenrollinatvetinstitu f17j
cap lab var f17j "how interesting if enroll TVET: masonry"
cap ren mechanicalfitterifyouenrollinatv f17k
cap lab var f17k "how interesting if enroll TVET: mechanics"
cap ren panelbeatingdentingandpantingify f17l
cap lab var f17l "how interesting if enroll TVET: panelbeating"
cap ren patrawoodcarvingifyouenrollinatv f17m
cap lab var f17m "how interesting if enroll TVET: patra"
cap ren plumbingifyouenrollinatvetinstit f17n
cap lab var f17n "how interesting if enroll TVET: plumbing"
cap ren v340 f17o
cap lab var f17o "how interesting if enroll TVET: transformer"
cap ren hotelortourismmanagementifyouenr f17p
cap lab var f17p "how interesting if enroll TVET: hotel, tourism"
cap ren foodproductionifyouenrollinatvet f17q
cap lab var f17q "how interesting if enroll TVET: food prod"
cap ren tailoringifyouenrollinatvetinsti f17r
cap lab var f17r "how interesting if enroll TVET: tailoring"

* Self beliefs about population and own labor outcomes
cap ren bachelorsdegreesamongmenwhoareab g1a_m
cap lab var g1a_m "belief: pop employment with univ"
cap ren v2945 g1b_m
cap lab var g1b_m "belief: pop employment with TTI"
cap ren stopeducationafterhighschoolamon g1c_m
cap lab var g1c_m "belief: pop employment with HS"

cap ren bachelorsdegreesamongthefulltime g2a_m
cap lab var g2a_m "belief: pop earnings with univ"
cap ren technicaltraininginstitutettiori g2b_m
cap lab var g2b_m "belief: pop earnings with TTI"
cap ren v2949 g2c_m
cap lab var g2c_m "belief: pop earnings with HS"

cap ren bachelorsdegreesamongwomenwhoare g1a_f
cap lab var g1a_f "belief: pop employment with univ"
cap ren v2951 g1b_f
cap lab var g1b_f "belief: pop employment with TTI"
cap ren v2952 g1c_f
cap lab var g1c_f "belief: pop employment with HS"

cap ren v2953 g2a_f
cap lab var g2a_f "belief: pop earnings with univ"
cap ren v2954 g2b_f
cap lab var g2b_f "belief: pop earnings with TTI"
cap ren v2955 g2c_f
cap lab var g2c_f "belief: pop earnings with HS"

cap ren bachelorsdegreescomparedtoallstu g3a
cap lab var g3a "belief: relative academic perf choosing univ"
cap ren v2957 g3b
cap lab var g3b "belief: relative academic perf choosing TTI"
cap ren stopeducationafterhighschoolcomp g3c
cap lab var g3c "belief: relative academic perf choosing HS"

* Own labor market outcomes
cap ren bachelorsdegreeswhatdoyoubelieve g4a
cap lab var g4a "belief: own employment with univ"
cap ren v2960 g4b
cap lab var g4b "belief: own employment with TTI"
cap ren v2961 g4c
cap lab var g4c "belief: own employment with HS"

cap ren bachelorsdegreesimaginethatyouha g5a
cap lab var g5a "belief: own earnings with univ"
cap ren v2963 g5b
cap lab var g5b "belief: own earnings with TTI"
cap ren stopeducationafterhighschoolimag g5c
cap lab var g5c "belief: own earnings with HS"

* Approval 
cap ren bachelorsdegreesimaginethatyouch g7a
cap ren v2966 g7b
cap ren v2967 g7c
cap lab var g7a "Approval of parents if choosing univ"
cap lab var g7b "Approval of parents if choosing TTI"
cap lab var g7c "Approval of parents if choosing HS"

cap ren v2968 g8a
cap ren v2969 g8b
cap ren v2970 g8c
cap lab var g8a "Approval of friends if choosing univ"
cap lab var g8b "Approval of friends if choosing TTI"
cap lab var g8c "Approval of friends if choosing HS"

cap ren v2971 g9a
cap ren v2972 g9b
cap ren v2973 g9c
cap lab var g9a "Approval of society if choosing univ"
cap lab var g9b "Approval of society if choosing TTI"
cap lab var g9c "Approval of society if choosing HS"

* Personalities 
cap ren isreservedhowmuchdoyouagreeordis p1a
cap ren tendstobelazyhowmuchdoyouagreeor p1b 
cap ren isoutgoingsociablehowmuchdoyouag p1c 
cap ren doesathoroughjobhowmuchdoyouagre p1d 
cap ren getsnervouseasilyhowmuchdoyouagr p1e 
cap ren hasanactiveimaginationhowmuchdoy p1f 
cap ren worriesalothowmuchdoyouagreeordi p1g 
cap ren remainscalmintensesituationshowm p1h 
cap ren istalkativehowmuchdoyouagreeordi p1i 
cap ren isoriginalcomesupwithnewideashow p1j 
cap ren valuesartisticaestheticexperienc p1k 
cap ren issometimesrudetoothershowmuchdo p1l 
cap ren hasaforgivingnaturehowmuchdoyoua p1m 
cap ren isconsiderateandkindtoalmostever p1n 
cap ren doesthingsefficientlyhowmuchdoyo p1o 

* Family background 
cap ren isyourfatheralive x1
cap lab var x1 "father alive"
cap ren doyoucurrentlylivewithyourfather x2
cap lab var x2 "living with father"
cap ren whatisthehighestlevelofeducation x3 
cap lab var x3 "father education"
cap ren whichofthefollowingbestdescribes x4
cap lab var x4 "father job"
cap ren inwhichsectordoesyourfatherwork x5
cap lab var x5 "father job industry"

cap ren isyourmotheralive x6
cap lab var x6 "mother alive"
cap ren doyoucurrentlylivewithyourmother x7
cap lab var x7 "living with mother"
cap ren v2998 x8
cap lab var x8 "mother education"
cap ren v2999 x9
cap lab var x9 "mother job"
cap ren inwhichsectordoesyourmotherwork x10
cap lab var x10 "mother job industry"

* Wealth
cap ren landplotdoyourparentsandotherhou x11a
cap lab var x11a "wealth: land plot"
cap ren housebuildingdoyourparentsandoth x11b
cap lab var x11b "wealth: house building"
cap ren vehiclenoncommercialdoyourparent x11c
cap lab var x11c "wealth: noncommercial vehicle"
cap ren motorcycledoyourparentsandotherh x11d
cap lab var x11d "wealth: motorcycle"
cap ren refrigeratordoyourparentsandothe x11e
cap lab var x11e "wealth: fridge"
cap ren washingmachinedoyourparentsandot x11f
cap lab var x11f "wealth: washing machine"
cap ren tvdoyourparentsandotherhousehold x11g
cap lab var x11g "wealth: tv"
cap ren mobilephonedoyourparentsandother x11h
cap lab var x11h "wealth: mobilephone"
cap ren computerdesktoporlaptopdoyourpar x11i
cap lab var x11i "wealth: computer"

* Siblings
cap ren howmanysiblingsdoyouhave x12
cap lab var x12 "siblings: total number"
cap destring x12, replace
cap ren howmanyofyoursiblingsarecurrentl x13a
cap lab var x13a "siblings: univ"
cap destring x13a, replace
cap ren v3014 x13b
cap lab var x13b "siblings: TTI"
cap destring x13b, replace

* Relatives
cap ren howmanyofyourrelativesexcludingp x14a
cap lab var x14a "relatives: univ"
cap destring x14a, replace
cap ren v3016 x14b
cap lab var x14b "relatives: TTI"
cap destring x14b, replace

* Friends
cap ren nameoffriendpleasewritedownthena y1a1
cap lab var y1a1 "friend 1: name"
cap ren v3018 y1b1 
cap lab var y1b1 "friend 2: name"
cap ren v3019 y1c1
cap lab var y1c1 "friend 3: name"
format y1*1 %30s

cap ren academicstreampleasewritedownthe y1a4
cap ren v3021 y1b4
cap ren v3022 y1c4
cap lab var y1a4 "friend 1: stream"
cap lab var y1b4 "friend 2: stream"
cap lab var y1c4 "friend 3: stream"

cap ren phonenumberpleasewritedownthenam y1a2
cap lab var y1a2 "friend 1: phone"
cap ren v3024 y1b2
cap lab var y1b2 "friend 2: phone"
cap ren v3025 y1c2
cap lab var y1c2 "friend 3: phone"
format y1*2 %10s

cap ren emailpleasewritedownthenamesofyo y1a3
cap lab var y1a3 "friend 1: email"
cap ren v3027 y1b3
cap lab var y1b3 "friend 2: email"
cap ren v3028 y1c3
cap lab var y1c3 "friend 3: email"
format y1*3 %30s

* Hobbies
cap ren listentomusichowmuchdoyoulikethe z1a
cap lab var z1a "hobby: listen to music" 
cap ren playmusichowmuchdoyoulikethefoll z1b 
cap lab var z1b "hobby: play music"
cap ren watchsportshowmuchdoyoulikethefo z1c
cap lab var z1c "hobby: watch sports"
cap ren playsportshowmuchdoyoulikethefol z1d
cap lab var z1d "hobby: play sports"
cap ren watchtvhowmuchdoyoulikethefollow z1e
cap lab var z1e "hobby: watch tv"
cap ren playvideoandonlinegameshowmuchdo z1f
cap lab var z1f "hobby: play videoonline games"

* Codes shared by Checku to correct school names
cap ren pleasespecifythenameofyoursecond other_school

foreach var of varlist other_school {
replace `var'= trim(itrim(lower(`var')))  // reduce multiple & consecutive blanks/make words into lower case
replace `var'= subinstr(`var'," ","",.)   //Removes spacing between words
replace `var'= subinstr(`var',",","",.)   //Removes comma (,)
replace `var'= subinstr(`var',"'","",.)   //Removes apostrophe (')
replace `var'= subinstr(`var',".","",.)   //Removes dot (.) 
replace `var'= subinstr(`var',"/","",.)   //Removes slash (/)
replace `var'= subinstr(`var',"-","",.)   //Removes dash (-)
replace `var'= subinstr(`var',"(","",.)   //Removes opening parentheses
replace `var'= subinstr(`var',")","",.)   //Removes closing parentheses
}

replace other_school="Babesa Higher Secondary School" if regexm(other_school,"babesa|babea|bhabe")
replace other_school="Changangkha Middle Secondary School" if regexm(other_school,"changang")
replace other_school="Changzamtog Middle Secondary School" if regexm(other_school,"changzam|chgangzam|channgzam|chgangzm|chnagzam|cnahgzam")
replace other_school="Chapcha Middle Secondary School" if regexm(other_school,"chapcham")
replace other_school="Choekhorling Middle Secondary School" if regexm(other_school,"choekho|chokhor")
replace other_school="Zilukha Middle Secondary School" if regexm(other_school,"zil|zlu")
replace other_school="Yangchenphug Higher Secondary School" if regexm(other_school,"yangchen|yanchen|yhss")
replace other_school="Samdrupjongkhar Middle Secondary School" if regexm(other_school,"samdrup")
replace other_school="Bajo Higher Secondary School" if regexm(other_school, "baj")
replace other_school="Bartsham Central School" if regexm(other_school, "bart")
replace other_school="Bitekha Middle Secondary School" if regexm(other_school,"bite")
replace other_school="Bjishong Central School" if regexm(other_school,"bjis|bjs")

replace other_school="Buli Central School" if regexm(other_school,"buli")
replace other_school="Chapcha Middle Secondary School" if regexm(other_school,"chacha")

replace other_school="Chukha Central School" if regexm(other_school, "chukha|chhukha|chuukha")
replace other_school="Chaskhar Central School" if regexm(other_school,"chas")
replace other_school="Chhumey Central School" if regexm(other_school,"chhumey|chumey|chummy")
replace other_school="Chumigthang Middle Secondary School" if regexm(other_school,"chumig")
replace other_school="Chundu Armed Forces Public Central School" if regexm(other_school,"chund")
replace other_school="Daga Central School" if regexm(other_school,"dadacs|dagac|dagah|dagan")
replace other_school="Dagapela Midde Secondary School" if regexm(other_school,"dagape")
replace other_school="Damphu Central School" if regexm(other_school,"damphuc")
replace other_school="Dashiding Higher Secondary School" if regexm(other_school,"dashi")
replace other_school="Dechencholing Higher Secondary School" if regexm(other_school,"dechench|dechgen|dexhen")
replace other_school="Desi Higher Secondary School" if regexm(other_school,"desi|deso|dessi")
replace other_school="Dashiding Higher Secondary School" if regexm(other_school,"dhas")
replace other_school="Dorokha Central School" if regexm(other_school,"doro")
replace other_school="Dr. Tobgyel School" if regexm(other_school,"drt|doctor")
replace other_school="Drukgyel Central School" if regexm(other_school,"drug|drukg")
replace other_school="Drukjegang Central School" if regexm(other_school,"drukj|druje")
replace other_school="Druk School" if regexm(other_school,"drukschool")
replace other_school="Dungsam Academy" if regexm(other_school,"dungs")
replace other_school="Bjishong Central School" if regexm(other_school,"bjish|bjs")
replace other_school="Chapcha Middle Secondary School" if regexm(other_school,"chapcha")
replace other_school="Garpawoong Middle Secondary School" if regexm(other_school,"garpa|garpo")
replace other_school="Gaselo Central School" if regexm(other_school,"gaselo")
replace other_school="Gelephu Higher Secondary School" if regexm(other_school,"gelephuh")
replace other_school="Wangbama Central School" if regexm(other_school,"genekha|wanba")
replace other_school="Gesarling Central School" if regexm(other_school,"gesar")
replace other_school="Gomdar Central School" if regexm(other_school, "gomd")
replace other_school="Gomtu Higher Secondary School" if regexm(other_school, "gomtu")
replace other_school="Gongthung Middle Secondary School" if regexm(other_school, "gongt")
replace other_school="Gongzim Ugyen Dorji Central School" if regexm(other_school, "gongz")
replace other_school="Gyelpozhing Central School" if regexm(other_school, "gyelpo|gyalpo")
replace other_school="Jakar Higher Secondary School" if regexm(other_school, "hakar|jaj|jakarh")
replace other_school="Jampel Higher Secondary School" if regexm(other_school, "jampel")
replace other_school="Jangchubling Middle Secondary" if regexm(other_school, "jangchub")
replace other_school="Jigmecholing Middle Secondary School" if regexm(other_school, "jigmechoe")
replace other_school="Jigme Sherubling Central School" if regexm(other_school, "jigmeshe|jlhamoyz")
replace other_school="Jomotsangkha Middle Secondary School" if regexm(other_school, "jomotsa|jomotsha")
replace other_school="Kabesa Central School" if regexm(other_school, "kabesa")
replace other_school="Kamji Central School" if regexm(other_school, "kamji")
replace other_school="Karma Academy" if regexm(other_school, "karmaacademy|karmaa|kramaacademy")
replace other_school="Karmaling Higher Secondary School" if regexm(other_school,"karmaling|karmlinghighersecondaryschool")
replace other_school="Kelki Higher Secondary School" if regexm(other_school, "kelki")
replace other_school="Kuendrup Higher Secondary School" if regexm(other_school, "kendrup")
replace other_school="Kengkhar Middle Secondary School" if regexm(other_school, "kengkhar")
replace other_school="Khasadrapchu Middle Secondary School" if regexm(other_school, "khada")
replace other_school="Arekha Middle Secondary School" if regexm(other_school, "arekha")
replace other_school="Changangkha Middle Secondary School" if regexm(other_school, "changangkha")
replace other_school="Changzamtog Middle Secondary School" if regexm(other_school, "changzamto")
replace other_school="Chokhorling Middle Secondary School" if regexm(other_school, "choeckhor|chokhor")
replace other_school="Chukha Central School" if regexm(other_school, "chukh")
replace other_school="Chukha Central School" if regexm(other_school, "chukh|chukkh")
replace other_school="Chhumey Central School" if regexm(other_school, "chummey")
replace other_school="Damphu Middle Secondary School" if regexm(other_school, "damphu")
replace other_school="Darla Middle Secondary School" if regexm(other_school, "darla")
replace other_school="Dashiding Higher Secondary School" if regexm(other_school, "dasguding")
replace other_school="Dechentsemo Central School" if regexm(other_school, "dechentse")
replace other_school="Chukha Central School" if regexm(other_school, "chuckha")
replace other_school="Dechentsemo Central School" if regexm(other_school, "dechentshemo")
replace other_school="Drametse Central School" if regexm(other_school, "drametse")
replace other_school="Dungtse Central School" if regexm(other_school, "dungtse")
replace other_school="Dungtse Central School" if regexm(other_school, "dungtshe")
replace other_school="Gongzim Ugyen Dorji Central School" if regexm(other_school,"gonzim")
replace other_school="Gyelpozhing Central School" if regexm(other_school,"gyei")
replace other_school="Jakar Higher Secondary School" if regexm(other_school,"jakar|jaker|jakhar")
replace other_school="Jampel Higher Secondary School" if regexm(other_school,"jamp")
replace other_school="Jigme Sherubling Central School" if regexm(other_school,"jimesherublingcentralschool")
replace other_school="Loseling Middle Secondary School" if regexm(other_school,"loselingmiddlesecondaryschool|loselingsecondaryschool|loslingmiddlesecondaryschool|losselingmiddlesecondaryschool")
replace other_school="Motithang Higher Secondary School" if regexm(other_school,"moithanghighersecondaryschool|mhss|motithang| motitihanghss")
replace other_school="Khangkhu Middle Secondary School" if regexm(other_school,"khangkhu")
replace other_school="Khasadrapchu Middle Secondary School" if regexm(other_school,"khasadrap")
replace other_school="Khuruthang Middle Secondary School" if regexm(other_school,"khuruthang")

replace other_school="Kuendrup Higher Secondary School" if regexm(other_school,"kuendrup|kuendryp|kundrup")
replace other_school="Lamgong Middle Secondary School" if regexm(other_school,"lamgong")
replace other_school="Kuzhugchen Middle Secondary School" if regexm(other_school,"kuzhugchenmiddlesecondaryschool")
replace other_school="Laya Central School" if regexm(other_school,"layacentral")
replace other_school="Lhamoyzingkha Central School" if regexm(other_school,"lhamo")

replace other_school="Losel Gyatsho Academy" if regexm(other_school,"losalgy|losealgy|loselgy")
replace other_school="Loseling Middle Secondary School" if regexm(other_school,"loselling|losling|loslling")
replace other_school="Losel Gyatsho Academy" if regexm(other_school,"loseljya|lpselgy")
replace other_school="Kamji Central School" if regexm(other_school,"kami")
replace other_school="Kunzangling Central School" if regexm(other_school,"kunzang")
replace other_school="Lungtenphu Middle Secondary School" if regexm(other_school,"lungtenp|luntenphum")
replace other_school="Lungtenzampa Middle Secondary School" if regexm(other_school,"lungtenz|luentenzam|lyngten")
replace other_school="Martshala Central School" if regexm(other_school,"martshala")
replace other_school="Mendregang Central School" if regexm(other_school,"mendral")
replace other_school="Mendregang Central School" if regexm(other_school,"mendreal")
replace other_school="Mendregang Central School" if regexm(other_school,"mendreg")
replace other_school="Mendregang Central School" if regexm(other_school,"mendrelgang")
replace other_school="Mendregang Central School" if regexm(other_school,"mendrelga")
replace other_school="Minjiwoong Central School" if regexm(other_school,"miji|minji")
replace other_school="Mongar Higher Secondary School" if regexm(other_school,"mongarh")
replace other_school="Mongar Middle Secondary School" if regexm(other_school,"mongarm|mongarsec")
replace other_school="Mongar Higher Secondary School" if regexm(other_school,"monggarh|mongerh")
replace other_school="Mongar Sherub Reldri Higher Secondary School" if regexm(other_school,"mongarsher")
replace other_school="Motithang Higher Secondary School" if regexm(other_school,"mothithanghi|mothithangse|motitanghi|motithanghi|motithanghss")
replace other_school="Nagor Middle Secondary School" if regexm(other_school,"nador|nagor")
replace other_school="Nangkor Central School" if regexm(other_school,"nangkor")
replace other_school="Gelephu Higher Secondary School" if regexm(other_school,"gelephumid")
replace other_school="Nganglam Central School" if regexm(other_school,"nganglamc")
replace other_school="Nganglam Central School" if regexm(other_school,"ngagl|ngan")
replace other_school="Nganglam Middle Secondary School" if regexm(other_school,"ngangalmh|ngabglamcentralschool")
replace other_school="Nima Higher Secondary Shool" if regexm(other_school,"nimah")
replace other_school="Nima Higher Secondary Shool" if regexm(other_school,"nima")
replace other_school="Nima Higher Secondary Shool" if regexm(other_school,"norbua")
replace other_school="Norbugang Central School" if regexm(other_school,"norbuga")
replace other_school="Orong Central School" if regexm(other_school,"orong")
replace other_school="Nganglam Central School" if regexm(other_school,"nganglanc")
replace other_school="Norbugang Central School" if regexm(other_school,"norb")
replace other_school="Motithang Higher Secondary School" if regexm(other_school,"motithngs|motithse|motiththang")
replace other_school="Nganglam Middle Secondary School" if regexm(other_school,"nganglamm")
replace other_school="Pakshika Central School" if regexm(other_school,"paksh|pashik")
replace other_school="Pelkhil Higher Secondary School" if regexm(other_school,"pekhil|pelhkil|pelikh|pelkhail|pelkhel|pelkhi|pelki"|)
replace other_school="Losel Gyatsho Academy" if regexm(other_school,"loselgaytshoacadmey|losegya")
replace other_school="Pakshika Central School " if regexm(other_school,"pakishakhacentralschool")
replace other_school="Peljorling Higher Secondary School" if regexm(other_school,"pelj")
replace other_school="Pelrithang Higher Secondary School" if regexm(other_school,"pelri")
replace other_school="Phuentsholing Middle Secondary School" if regexm(other_school,"phuentshol")
replace other_school="Phobjikha Central School" if regexm(other_school,"phobji")
replace other_school="Phuntshothang Middle Secondary School" if regexm(other_school,"phuntshothang")
replace other_school="Phuentsholing Middle Secondary School" if regexm(other_school,"phuntshol")
replace other_school="Punakha Central School" if regexm(other_school,"punak|punkha")
replace other_school="Radi Middle Secondary School" if regexm(other_school,"radhi")
replace other_school="Rangjung Central School" if regexm(other_school,"rangj")
replace other_school="Rangjung Central School" if regexm(other_school,"ranj")
replace other_school="Rinchen  Higher Secondary School" if regexm(other_school,"renchen|richen|rinchen")
replace other_school="Rigzom Academy" if regexm(other_school,"rig")
replace other_school="Samcholing Higher Secondary School" if regexm(other_school,"samcho")
replace other_school="Ramdrupjongkhar Middle Secondary School" if regexm(other_school,"samdrupj")
replace other_school="Rinchen  Higher Secondary School" if regexm(other_school,"rinche")
replace other_school="Pemagatshel Middle Secondary School" if regexm(other_school,"pema")
replace other_school="Samtengang Central School" if regexm(other_school,"samten")
replace other_school="Samtse Higher Secondary School" if regexm(other_school,"samtseh|samtses")
replace other_school="Sarpang Central School" if regexm(other_school,"sapangc|sarpangc")
replace other_school="Sarpang Higher Secondary School" if regexm(other_school,"sapangh|sarpangh")
replace other_school="Sarpang Middle Secondary School" if regexm(other_school,"sarpangmiddlesecondaryschool")
replace other_school="Shaba Higher Secondary School" if regexm(other_school,"shaba")
replace other_school="Shaba Higher Secondary School" if regexm(other_school,"shabhi")
replace other_school="Mongar Sherub Reldri Higher Secondary School" if regexm(other_school,"sharab|sherabrd|sherabreldhi|sherabreldihss|sherabreldri|sherabreldrihighersecondaryschoolsherubreldhihss|sherubreldihighersecondaryschool|sherubreldisecondaryschool|sherubreldri|sherubreldrihighersecondaryschool|sherubreldrihighsecondaryschool|sherubreldrisecondaryschool")
replace other_school="Shari Hugher Secondary School" if regexm(other_school,"shari|sshari")
replace other_school="Samcholing Higher Secondary School" if regexm(other_school,"shemcholinghighersecondryschool")
replace other_school="Sonamgang Middle Secondary School" if regexm(other_school,"sonamg")
replace other_school="Sonam Kuenphen Higher Secondary School" if regexm(other_school,"sonamk")
replace other_school="SonamThang Central School" if regexm(other_school,"sonamthang")
replace other_school="Sherubling Central School" if regexm(other_school,"sherublingcentralschool|sherublingcentr")


replace other_school="Samtse Higher Secondary School" if regexm(other_school,"smatsehighersecondaryschool")
replace other_school="Tashitse Higher Secondary School" if regexm(other_school,"taahitsehighersecondaryschool| tashistehighersecondaryschool|tashitse|tashitestashist")
replace other_school="Taktse Central School" if regexm(other_school,"taktse")
replace other_school="Mongar Sherub Reldri Higher Secondary Schooll" if regexm(other_school,"sherubreldhihss")
replace other_school="Tang Central School" if regexm(other_school,"tang")
replace other_school="Tashitse Higher Secondary School" if regexm(other_school,"tashiste|tashitshe")
replace other_school="Tashidingkha Central School" if regexm(other_school,"tashidingkhacentralschool")
replace other_school="Trashigang Middle Secondary School" if regexm(other_school,"tashigangm")
replace other_school="Tashitse Higher Secondary School" if regexm(other_school,"tashitdse|tashites")
replace other_school="Tendruk Central School" if regexm(other_school,"tendeuk|tendruktenduek|tendurk")
replace other_school="Tendruk Central School" if regexm(other_school,"tendeuk|tendruk|tenduek|tendurk")
replace other_school="Tendruk Central School" if regexm(other_school," tendrku|tendru|tendruikcentral")
replace other_school="Thrimshing Central School" if regexm(other_school,"thrimshingcentralschool")
replace other_school="Trashigang Middle Secondary School" if regexm(other_school,"trashigangmiddlesecondaryschool")
replace other_school="Tendruk Central School" if regexm(other_school,"tendrku")
replace other_school="Thrimshing Central School" if regexm(other_school,"thrimshing")
replace other_school="Tashitse Higher Secondary School" if regexm(other_school,"trashitsehighersecondaryschool")
replace other_school="Tashitse Higher Secondary School" if regexm(other_school,"tashihighersecondaryschool")
replace other_school="Tshangkha Central School" if regexm(other_school,"tsangkhacentralschool|tshangkha|tshngkha")
replace other_school="Tsenkharla Central School" if regexm(other_school,"tsenkharlacentralschool")
replace other_school="Tsimalakha Middle  Secondary School" if regexm(other_school,"tshimalhakhalowersecondaryschool")
replace other_school="Tshangkha Central School" if regexm(other_school,"tshongkhagsecondaryschool")
replace other_school="Tsirang Toe Central School" if regexm(other_school,"tsirangtoecentalschool|tsirangtoecentralschool")
replace other_school="Tendruk Central School" if regexm(other_school,"twndrukcentralschool")
replace other_school="Gongzim Ugyen Dorji Central School" if regexm(other_school,"ugyendorjicentralschool")
replace other_school="Ura Central School" if regexm(other_school,"ura")
replace other_school="UTPAL Academy" if regexm(other_school,"utpal")
replace other_school="Wangbama Central School" if regexm(other_school,"wangbama")
replace other_school="Wangchu Middle Secondary School" if regexm(other_school," wangchumiddlesecondaryschool|wangchumss|wangchhumss")
replace other_school="Wangchu Middle Secondary School" if regexm(other_school,"wangchumiddlesecondaryschool|wangchumss")
replace other_school="Yadi Central School" if regexm(other_school,"yadi|yadhi")
replace other_school="Yangchenphug Higher Secondary School" if regexm(other_school,"yangchen")
replace other_school="Yangchenphug Higher Secondary School" if regexm(other_school,"yanchengphughighersecondaryschool|yanchenphughighersecondaryschool|yandchenphughighersecondaryschool|yang|yangch|yangche")
replace other_school="Yebilaptsa Central School" if regexm(other_school,"yebi")
replace other_school="Yelchen Central School" if regexm(other_school,"yelchencentralschool")
replace other_school="Yonten Kuenjung Academy" if regexm(other_school,"yentenkungung|yentonkuenjungacademy|yeonteonkuenjung|yoenten|yountenk|yontenkuen|younten|yonten|yout|youent")
replace other_school="Yonten Kuenjung Academy" if regexm(other_school,"yoeutenkuenjungacadamey|yontenkenjungacademy|yontenkunejungacademy|yontenkunjungacademy|youentenkenzungacademy|youtenkuenjungacademy")
replace other_school="Yoezerling Higher Secondary School" if regexm(other_school,"yeozerlinghighersecondaryschool| yoezerlinghighersecondaryschool")
replace other_school="Yoezerling Higher Secondary School" if regexm(other_school,"yeozerlinghighersecondaryschool|yoezerlinghighersecondaryschool")
replace other_school="Yoeseltse Middle Secondary School" if regexm(other_school,"yoeseltsemiddlesecondaryschool")
replace other_school="Zhemgang Central School" if regexm(other_school,"zhamg|zhemg")
replace other_school="Zhemgang Central School" if regexm(other_school,"zhemagagcentralschool|zhem")
replace other_school="Yangchenphug Higher Secondary School" if regexm(other_school,"yhss")
replace other_school="Zilukha Middle Secondary School" if regexm(other_school,"zilukhamiddlesecondaryschool|zilukhamss|zilu")
replace other_school="Yangchenphug Higher Secondary School" if regexm(other_school,"yengchenphughighersecondaryschool")
replace other_school="Ugyen Academy" if regexm(other_school,"ugyenacademy")
replace other_school="Changzamtog Middle Secondary School" if regexm(other_school,"chagzamtogmiddelsecoundaryschool|chamzamtogmiddlesecondaryschool")
replace other_school="Dechentsemo Central School" if regexm(other_school,"dechentshenmohigherschool")
replace other_school="ELC High School" if regexm(other_school,"elc|elch|elchigh|elchighersecondaryschool|elchighschool|elchighsecondaryschool")
replace other_school="Jakar Higher Secondary School" if regexm(other_school,"jarkarhighersecondayschool|jaka")
replace other_school="Samtse Higher Secondary School" if regexm(other_school,"samstehighersecondaryschool|samtse|samtsegi")
replace other_school="Yonten Kuenjung Academy" if regexm(other_school,"yentenkunjungacademy|yontuenkuenjungacademy|yoten")
replace other_school="Yurung Central School" if regexm(other_school,"yurungcentralschool")
replace other_school="Yurung Central School" if regexm(other_school,"yurungcentralschool")

replace other_school="Kidheykhar Central School" if regexm(other_school,"kidheykha")

*calling each student
replace other_school="Zhemgang Central School" if regexm(other_school,"20100288110105")
replace other_school="Yangchenphug Higher Secondary School" if regexm(other_school,"2010033110180")

replace other_school="Rangjung Central School" if regexm(other_school,"bidunglowersecondaryschool")
replace other_school="Rangjung Central School" if regexm(other_school,"bika|bikhar")
replace other_school="Sarpang Central School" if regexm(other_school,"birkhabdrmonger")
replace other_school="Drukgyel Central School" if regexm(other_school,"bumdelinglowersecondaryschool")
replace other_school="Chapcha Middle Secondary School" if regexm(other_school,"cahpch|chapcamiddlesecondaryschool")
replace other_school="Chukha Central School" if regexm(other_school, "ccs|chuk")
replace other_school="Damphu Central School" if regexm(other_school,"centralschooll")

replace other_school="Changangkha Middle Secondary School" if regexm(other_school, "cgang|changkhamiddlesecondaryschool")
replace other_school="Drukjegang Central School" if other_school=="d"
replace other_school="Damphu Central School" if other_school=="da"
replace other_school="Damphu Central School" if other_school=="khenisecondaryschool"

replace other_school="Damphu Central School" if other_school=="dmaphucentralschool"
replace other_school="Chundu Armed Forces Public Central School" if other_school=="damthanglowersecondaryschool"

replace other_school="Daga Central School" if other_school=="datacentralschool"
replace other_school="Dechentsemo Central School" if other_school=="dech"

replace other_school="Dorokha Central School" if regexm(other_school,"denchukahalowersecondaryschool")
replace other_school="Druk School" if other_school=="dru"

replace other_school="Dungsam Academy" if regexm(other_school,"duingsamacademy")

replace other_school="Chukha Central School" if regexm(other_school, "dungnalowersecondaryschool|dungnalowersecoundaryschool")
replace other_school="Gelephu Higher Secondary School" if other_school=="gelephu"
replace other_school="Gelephu Higher Secondary School" if other_school=="gelephu"
replace other_school="Losel Gyatsho Academy" if other_school=="gelephulowersecondary"
replace other_school="Damphu Central School" if other_school=="gelephulowersecondaryschool"
replace other_school="Gaselo Central School" if other_school=="gh"
replace other_school="Zhemgang Central School" if other_school=="gomphulowersecondaryscholl"
replace other_school="Zhemgang Central School" if other_school=="gomphulowersecondaryschool"
replace other_school="Gyelpozhing Central School" if other_school=="gy"
replace other_school="Jakar Higher Secondary School" if other_school=="ja"

replace other_school="Jigme Sherubling Central School" if other_school=="jerelemisecondaryschool"
replace other_school="Jigme Sherubling Central School" if other_school=="jig"
replace other_school="Jigme Sherubling Central School" if other_school=="khalinglowernsecondaryschool"
replace other_school="Jigme Sherubling Central School" if other_school=="khalinglowersecondaryschool"
replace other_school="Mongar Sherub Reldri Higher Secondary School" if regexm(other_school,"lingmethanglowersecondaryschool")
replace other_school="Mongar Sherub Reldri Higher Secondary School" if regexm(other_school,"lobesa")

replace other_school="Losel Gyatsho Academy" if other_school=="losel"
replace other_school="Losel Gyatsho Academy" if other_school=="loselg"
replace other_school="Mendregang Central School" if other_school=="m"
replace other_school="Mendregang Central School" if other_school=="men"
replace other_school="Mendregang Central School" if other_school=="mendre"

replace other_school="Babesa Higher Secondary School" if other_school=="minjeymiddlesecondaryschool"
replace other_school="Mongar Higher Secondary School" if other_school=="monga"
replace other_school="Mongar Higher Secondary School" if other_school=="mongar"
replace other_school="Jampel Higher Secondary School" if other_school== "mongermss"
replace other_school="Samcholing Higher Secondary School" if other_school=="na" & district=="Trongsa"
replace other_school="Bajo Higher Secondary School" if other_school=="na" & district=="Trongsa"
replace other_school="Pelrithang Higher Secondary School" if other_school=="plerithangmiddlesecondaryschool"
replace other_school="Punakha Central School" if responseid==26656
replace other_school="Jampel Higher Secondary School" if responseid==30037
replace other_school="Samtse Higher Secondary School" if responseid==20862
replace other_school="Samtse Higher Secondary School" if responseid==14452
replace other_school="Samcholing Higher Secondary School" if responseid==31998
replace other_school="Sarpang Central School" if responseid==2144
replace other_school="Sarpang Central School" if responseid==26955
replace other_school="Sarpang Central School" if responseid==12173

replace other_school="Sarpang Higher Secondary School" if responseid==33704
replace other_school="Sarpang Higher Secondary School" if responseid==9565
replace other_school="Dorokha Central School" if responseid==2771
replace other_school="Rigzom Academy" if responseid==7731
replace other_school="Yadi Central School" if responseid==21379
replace other_school="Shaba Higher Secondary School" if responseid==4823
replace other_school="Sonam Kuenphen Higher Secondary School" if responseid==23415
replace other_school="Sonam Kuenphen Higher Secondary School" if responseid==19593
replace other_school="Taktse Central School" if responseid==30341
replace other_school="Tendruk Central School" if responseid==25813
replace other_school="Desi Higher Secondary School" if responseid==14608
replace other_school="Rangjung Central School" if responseid==9925
replace other_school="Rangjung Central School" if responseid==9945
replace other_school="Rangjung Central School" if responseid==11041
replace other_school="Baylling Central School" if responseid==957
replace other_school="Tshangkha Central School" if responseid==21115
replace other_school="Tshangkha Central School" if responseid==12093
replace other_school="Tshangkha Central School" if responseid==12232
replace other_school="Tsimalakha Middle  Secondary School" if regexm(other_school,"tshimalakhalss|tsima")
replace other_school="Tsirang Toe Central School" if responseid==33664
replace other_school="Tsirang Toe Central School" if responseid==33076
replace other_school="Gongzim Ugyen Dorji Central School" if responseid==17269
replace other_school="Wangbama Central School" if responseid==10415

replace other_school="Karma Academy" if responseid==26752

replace other_school="Jakar Higher Secondary School" if responseid==18102
replace other_school="Jakar Higher Secondary School" if responseid==10872
replace other_school="Jakar Higher Secondary School" if responseid==21838
replace other_school="Jakar Higher Secondary School" if responseid==10698
replace other_school="Jakar Higher Secondary School" if responseid==10889
replace other_school="Jakar Higher Secondary School" if responseid==13750
replace other_school="Jakar Higher Secondary School" if responseid==29548
replace other_school="Jakar Higher Secondary School" if responseid==32941
replace other_school="Jakar Higher Secondary School" if responseid==14074
replace other_school="Jakar Higher Secondary School" if responseid==29511
replace other_school="Jakar Higher Secondary School" if responseid==7560
replace other_school="Jakar Higher Secondary School" if responseid==19981
replace other_school="Jakar Higher Secondary School" if responseid==19981
replace other_school="Jakar Higher Secondary School" if regexm(other_school,"wangduechoelinglowers|wlss")
replace other_school="Yangchenphug Higher Secondary School" if responseid==10949
replace other_school="Yangchenphug Higher Secondary School" if responseid==9513
replace other_school="Jigme Sherubling Central School" if responseid==24058
replace other_school="Tashitse Higher Secondary School" if responseid==17369

* School name variable
forval i=16/38 {
	cap tostring v`i', replace
	replace v`i'="" if v`i'=="."
	replace schoolname=v`i' if (missing(schoolname)|schoolname=="Other (Specify)") & ~missing(v`i') & v`i'~="Other (Specify)"
}
cap replace schoolname = other_school if missing(schoolname) | schoolname=="Other (Specify)"

* Keep relevant variables 
keep responseid timestarted datesubmitted status name-schoolname stream studentid email email2 phone district_origin b1a-c3r c4 c5c1-f17r g1a_m-x4 x5 x6 x7 x8 x9 x10 x11a-z1f attentiveness

* save dataset 
save "$temp/grade1112_part1.dta", replace
















********************************************************************************
*
*						 AUGUST 17 DATASETS 
*
********************************************************************************	

import delimited "$raw/student/grade1112/20210918121630-SurveyExport.csv", clear

**************** DATA PROCESSING ***********************************************
* Personal information
cap ren whatisyourname name
cap ren whatisyourgender sex
replace sex=0 if sex==2
lab define sex 0 "Female" 1 "Male" 
lab val sex sex 
cap ren inwhichdzongkhagisyourschoolloca district
cap ren whatisthenameofyoursecondaryscho schoolname
cap ren dateofbirthdaywhatisyourdateofbi b_day
cap ren dateofbirthmonthwhatisyourdateof b_month
cap ren dateofbirthyearwhatisyourdateofb b_year
cap ren whatisyourstudentidcode studentid
cap ren whatisyouremailaddressprovidedby email
cap ren whatisyourprivateemailaddress email2
cap ren whatisyourmobilephonenumber phone
cap ren whichdzongkhagareyouoriginallyfr district_origin
tostring district_origin, replace
replace district_origin="Bumthang" if district_origin=="1"
replace district_origin="Chukha" if district_origin=="2"
replace district_origin="Phuntsholing Thromde" if district_origin=="3"
replace district_origin="Dagana" if district_origin=="4"
replace district_origin="Gasa" if district_origin=="5"
replace district_origin="Haa" if district_origin=="6"
replace district_origin="Lhuentse" if district_origin=="7"
replace district_origin="Mongar" if district_origin=="8"
replace district_origin="Paro" if district_origin=="9"
replace district_origin="Pema Gatshel" if district_origin=="10"
replace district_origin="Punakha" if district_origin=="11"
replace district_origin="Samdrup Jongkhar" if district_origin=="12"
replace district_origin="Sarpang" if district_origin=="13"
replace district_origin="Gelephu Thromde" if district_origin=="14"
replace district_origin="Thimphu" if district_origin=="15"
replace district_origin="Trashigang" if district_origin=="16"
replace district_origin="Trashi Yangtse" if district_origin=="17"
replace district_origin="Tsirang" if district_origin=="18"
replace district_origin="Wandue Phodrang" if district_origin=="19"
replace district_origin="Zhemgang" if district_origin=="20"
replace district_origin="Abroad" if district_origin=="21"

cap ren whatisyouracademicstream stream 

* Perception about education and employment
cap ren itisimportantformetoreceiveeduca b1a
cap lab var b1a "perception: it's important to receive education"
cap ren educationhelpsmegetabetterjobhow b1c
cap lab var b1c "perception: education helps me get a better job"

cap ren scienceandtechnologyaremakingour b2a
cap lab var b2a "perception: science makes lives healthier, easier, comfortable"
cap ren allthingsconsideredscienceandtec b2d 
cap lab var b2d "perception: science makes the world better off"

* Academic performance
cap ren mathwhatisyouracademicperformanc c1a
cap lab var c1a "performance: math"
cap ren dzongkhawhatisyouracademicperfor c1b
cap lab var c1b "performance: dzongkha"
cap ren englishwhatisyouracademicperform c1c
cap lab var c1c "performance: english"
cap ren physicswhatisyouracademicperform c1d 
cap lab var c1d "performance: physics"
cap ren chemistrywhatisyouracademicperfo c1e
cap lab var c1e "performance: chemistry"
cap ren biologywhatisyouracademicperform c1f
cap lab var c1f "performance: biology"
cap ren economicswhatisyouracademicperfo c1g
cap lab var c1g "performance: economics"
cap ren geographywhatisyouracademicperfo c1h
cap lab var c1h "performance: geography"
cap ren historywhatisyouracademicperform c1i
cap lab var c1i "performance: history"
cap ren ictwhatisyouracademicperformance c1j
cap lab var c1j "performance: ICT"
cap ren overallwhatisyouracademicperform c1k
cap lab var c1k "performance: overall"

* TVET courses in high school
cap ren haveyoutakenanytvetoptionalcours c2
cap lab var c2 "taken any TVET optional course?"
cap lab def tvet 1 "Yes" 2 "No"
cap lab val c2 tvet

cap ren animationwhichtvetoptionalcourse c3a
cap lab var c3a "tvet course taken: animation"
cap ren automobilemechanicwhichtvetoptio c3b 
cap lab var c3b "tvet course taken: automobile mechanic"
cap ren computerhardwareandnetworkingwhi c3c
cap lab var c3c "tvet course taken: computer hardware, networking"
cap ren electricalwhichtvetoptionalcours c3d
cap lab var c3d "tvet course taken: electrical"
cap ren furnituremakingwhichtvetoptional c3e
cap lab var c3e "tvet course taken: furniture"
cap ren heavyearthmoverwhichtvetoptional c3f
cap lab var c3f "tvet course taken: heavy earth mover"
cap ren heavyvehicledrivingwhichtvetopti c3g
cap lab var c3g "tvet course taken: heavy vehicle driving"
cap ren jimzowhichtvetoptionalcoursehave c3h
cap lab var c3h "tvet course taken: jimzo"
cap ren lhadriwhichtvetoptionalcoursehav c3i
cap lab var c3i "tvet course taken: lhadri"
cap ren masonrywhichtvetoptionalcourseha c3j
cap lab var c3j "tvet course taken: masonry"
cap ren mechanicalfitterwhichtvetoptiona c3k
cap lab var c3k "tvet course taken: mechanical fitter"
cap ren panelbeatingdentingandpantingwhi c3l
cap lab var c3l "tvet course taken: panel beating"
cap ren patrawoodcarvingwhichtvetoptiona c3m
cap lab var c3m "tvet course taken: patra"
cap ren plumbingwhichtvetoptionalcourseh c3n
cap lab var c3n "tvet course taken: plumbing"
cap ren repairmaintenanceandcommissionin c3o
cap lab var c3o "tvet course taken: repair, maintenance"
cap ren hotelortourismmanagementwhichtve c3p
cap lab var c3p "tvet course taken: hotel, tourism management"
cap ren foodproductionwhichtvetoptionalc c3q
cap lab var c3q "tvet course taken: food production"
cap ren tailoringwhichtvetoptionalcourse c3r
cap lab var c3r "tvet course taken: tailoring"

cap ren whydidyounotchoosetotaketvetopti c4
cap lab var c4 "reason not taking tvet course"

* Mentoring
cap ren parentsdoyoutalktoaboutyourcaree c5c1
cap lab var c5c1 "mentoring: parents"
cap ren brotherssistersdoyoutalktoabouty c5c2
cap lab var c5c2 "mentoring: siblings"
cap ren otherrelativesdoyoutalktoaboutyo c5c3
cap lab var c5c3 "mentoring: relatives"
cap ren friendsdoyoutalktoaboutyourcaree c5c4
cap lab var c5c4 "mentoring: friends"
cap ren neighborsdoyoutalktoaboutyourcar c5c5
cap lab var c5c5 "mentoring: neighbors" 
cap ren teachersorschoolcounselordoyouta c5c6
cap lab var c5c6 "mentoring: teachers school counselors"
cap ren othersdoyoutalktoaboutyourcareer c5c7 
cap lab var c5c7 "mentoring: others"

forval i=1/7 {
	cap replace c5c`i'="1" if ~missing(c5c`i')
	destring c5c`i', replace
	cap replace c5c`i'=0 if c5c`i'==.
}

* Education plans
cap ren iftherewerenobarriershowfarinsch c7
cap lab var c7 "education plan if no barriers"
cap ren asthingsstandnowhowfarinschooldo c8 
cap lab var c8 "education plan as things stand now"

* Preference about employment 
cap ren incomeforyourfutureeducationalan d1a
cap lab var d1a "importance to educareer: income"
cap ren prestigeandsocialstatusforyourfu d1c
cap lab var d1c "importance to educareer: prestige"
cap ren mygenuineinterestforyourfutureed d1d
cap lab var d1d "importance to educareer: genuine interest"
cap ren advicefromparentsorguardiansfory d1f
cap lab var d1f "importance to educareer: parents advice"
cap ren whatmyfriendsthinkandchooseforyo d1g
cap lab var d1g "importance to educareer: friends choice"
cap ren goodbalancebetweenprofessionalan d1h
cap lab var d1h "importance to educareer: worklife balance"
cap ren costsofeducationforyourfutureedu d1i
cap lab var d1i "importance to educareer: costedu"

cap ren agricultureforestryandfishingwhi d2a
cap lab var d2a "ranking perferred sector: agriculture"
cap ren miningwhichsectorswouldyouprefer d2b
cap lab var d2b "ranking perferred sector: mining"
cap ren manufacturingwhichsectorswouldyo d2c
cap lab var d2c "ranking perferred sector: manufacturing"
cap ren electricitygaswatersupplywastema d2d
cap lab var d2d "ranking perferred sector: public utilities"
cap ren constructionwhichsectorswouldyou d2e
cap lab var d2e "ranking perferred sector: construction"
cap ren retailwholesaletradingwhichsecto d2f
cap lab var d2f "ranking perferred sector: trade"
cap ren hotelrestaurantfoodserviceswhich d2g
cap lab var d2g "ranking perferred sector: hotel, food"
cap ren transportationwhichsectorswouldy d2h
cap lab var d2h "ranking perferred sector: transportation"
cap ren informationandcommunicationwhich d2i
cap lab var d2i "ranking perferred sector: ict"
cap ren financialandinsuranceactivitiesw d2j
cap lab var d2j "ranking perferred sector: finance"
cap ren educationwhichsectorswouldyoupre d2k
cap lab var d2k "ranking perferred sector: education"
cap ren healthwhichsectorswouldyouprefer d2l
cap lab var d2l "ranking perferred sector: health"
cap ren entertainmentartsrecreationwhich d2m
cap lab var d2m "ranking perferred sector: entertainment"
cap ren professionalscientificandtechnic d2n
cap lab var d2n "ranking perferred sector: science"

cap ren governmentwhichofthefollowingemp d3a
cap lab var d3a "ranking preferred employer: government"
cap ren governmentownedcorporationwhicho d3b
cap lab var d3b "ranking preferred employer: soe"
cap ren privatecompanywhichofthefollowin d3c
cap lab var d3c "ranking preferred employer: private"
cap ren runningnonfarmingbusinesswhichof d3d
cap lab var d3d "ranking preferred employer: own nonfarm"
cap ren farmingwhichofthefollowingemploy d3e
cap lab var d3e "ranking preferred employer: own farm"

cap ren iknowexactlywhichoccupationiwant d4a
cap lab var d4a "perception: know exactly which occupation to work"
cap ren bluecollarjobsarepoorlyperceived d4c
cap lab var d4c "perception: blue-collar jobs are poorly perceived in society"
cap ren bluecollarjobsareinferiortowhite d4d
cap lab var d4d "perception: blue-collar jobs are inferior to white collars"
cap ren evenwithgoodpayiwouldnttakebluec d4e
cap lab var d4e "perception: even with good pay, not take blue-collar jobs"
cap ren bluecollarjobsareformenrathertha d4g
cap lab var d4g "perception: blue-collar jobs are for men than women"

* Knowledge about university education and TVET education
cap ren universityeducationhowmuchdoyoua f1a
cap lab var f1a "knowledge: admission criteria to university"
cap ren tveteducationbytechnicaltraining f1b
cap lab var f1b "knowledge: admission criteria to tvet"

cap ren v141 f2a
cap lab var f2a "knowledge: application to university"
cap ren v142 f2b
cap lab var f2b "knowledge: application to tvet"

cap ren v143 f3a
cap lab var f3a "knowledge: curriculum of university"
cap ren v144 f3b
cap lab var f3b "knowledge: curriculum of tvet"

cap ren v145 f4a
cap lab var f4a "knowledge: student life at university"
cap ren v146 f4b
cap lab var f4b "knowledge: student life at tvet"

cap ren v147 f5a
cap lab var f5a "knowledge: tuition scholarship university"
cap ren v148 f5b
cap lab var f5b "knowledge: tuition scholarship tvet"

cap ren v149 f6a
cap lab var f6a "knowledge: graduation rate of university"
cap ren v150 f6b
cap lab var f6b "knowledge: graduation rate of tvet"

cap ren v151 f7a
cap lab var f7a "knowledge: future career of university"
cap ren v152 f7b
cap lab var f7b "knowledge: future career of tvet"

cap ren v153 f8a
cap lab var f8a "knowledge: overall university"
cap ren v154 f8b
cap lab var f8b "knowledge: overall tvet"


* Degree ranking by genuine interest 
cap ren bachelorssciencemathcomputerscie f9a
cap lab var f9a "ranking: SCI"
cap tostring f9a, replace 
cap ren bachelorsengineeringpleaserankth f9b
cap lab var f9b "ranking: ENG"
cap tostring f9b, replace 
cap ren bachelorsmedicinehealthandnursin f9c
cap lab var f9c "ranking: MED"
cap tostring f9c, replace 
cap ren bachelorseducationpleaserankthef f9d
cap lab var f9d "ranking: EDU"
cap tostring f9d, replace 
cap ren bachelorsbusinessmanagementecono f9e
cap lab var f9e "ranking: BUS"
cap tostring f9e, replace 
cap ren bachelorsartshumanitiesandsocial f9f
cap lab var f9f "ranking: ARTS"
cap tostring f9f, replace 
cap ren technicaldegreesnationalcertific f9g
cap lab var f9g "ranking: TTI"
cap tostring f9g, replace 
cap ren stopeducationafterhighschoolplea f9h
cap lab var f9h "ranking: HighSchool"
cap tostring f9h, replace 

* Based on academic performance, how difficult to enroll/complete
cap ren bachelorsdegreesbasedonyouracade f10a
cap lab var f10a "how difficult to enroll in university"
cap ren v164 f10b
cap lab var f10b "how difficult to enroll in tvet"

cap ren bachelorsdegreeshoweasyordifficu f11a
cap lab var f11a "how difficult to complete university"
cap ren v166 f11b
cap lab var f11b "how difficult to complete tvet"

cap ren bachelorsdegreeshowmuchdoyouthin f12a
cap lab var f12a "how much to enjoy curriculum of university"
cap ren v168 f12b
cap lab var f12b "how much to enjoy curriculum of tvet"

cap ren v169 f13a
cap lab var f13a "how much to enjoy student life of university"
cap ren v170 f13b
cap lab var f13b "how much to enjoy student life of tvet"

* Decision today 
cap ren v171 f14a 
cap lab var f14a "decision ranking: SCI"
cap ren bachelorsengineeringifyoutodayde f14b
cap lab var f14b "decision ranking: ENG"
cap ren v173 f14c
cap lab var f14c "decision ranking: MED"
cap ren bachelorseducationifyoutodaydeci f14d
cap lab var f14d "decision ranking: EDU"
cap ren v175 f14e
cap lab var f14e "decision ranking: BUS"
cap ren v176 f14f
cap lab var f14f "decision ranking: ARTS"
cap ren v177 f14g
cap lab var f14g "decision ranking: TTI"
cap ren stopeducationafterhighschoolifyo f14h
cap lab var f14h "decision ranking: HS"

* Sure about f14?
cap ren howsureareyouaboutyourchoicesand f15
cap lab var f15 "How sure about f14"

*  Beliefs about % of other students choice
cap ren v180 f16a_m
cap lab var f16a_m "belief: % male students choosing SCI"
cap ren bachelorsengineeringwhatpercenta f16b_m
cap lab var f16b_m "belief: % male students choosing ENG"
cap ren v182 f16c_m
cap lab var f16c_m "belief: % male students choosing MED"
cap ren bachelorseducationwhatpercentage f16d_m
cap lab var f16d_m "belief: % male students choosing EDU"
cap ren v184 f16e_m
cap lab var f16e_m "belief: % male students choosing BUS"
cap ren v185 f16f_m
cap lab var f16f_m "belief: % male students choosing ARTS"
cap ren v186 f16g_m
cap lab var f16g_m "belief: % male students choosing TTI"
cap ren stopeducationafterhighschoolwhat f16h_m
cap lab var f16h_m "belief: % male students choosing HS"

cap ren v188 f16a_f
cap lab var f16a_f "belief: % female students choosing SCI"
cap ren v189 f16b_f
cap lab var f16b_f "belief: % female students choosing ENG"
cap ren v190 f16c_f
cap lab var f16c_f "belief: % female students choosing MED"
cap ren v191 f16d_f
cap lab var f16d_f "belief: % female students choosing EDU"
cap ren v192 f16e_f
cap lab var f16e_f "belief: % female students choosing BUS"
cap ren v193 f16f_f
cap lab var f16f_f "belief: % female students choosing ARTS"
cap ren v194 f16g_f
cap lab var f16g_f "belief: % female students choosing TTI"
cap ren v195 f16h_f
cap lab var f16h_f "belief: % female students choosing HS"

* TVET courses 
cap ren animationifyouenrollinatvetinsti f17a
cap lab var f17a "how interesting if enroll TVET: animation"
cap ren automobilemechanicifyouenrollina f17b 
cap lab var f17b "how interesting if enroll TVET: automobile"
cap ren computerhardwareandnetworkingify f17c 
cap lab var f17c "how interesting if enroll TVET: computer"
cap ren electricalifyouenrollinatvetinst f17d
cap lab var f17d "how interesting if enroll TVET: electrics"
cap ren furnituremakingifyouenrollinatve f17e
cap lab var f17e "how interesting if enroll TVET: furniture"
cap ren heavyearthmoverifyouenrollinatve f17f
cap lab var f17f "how interesting if enroll TVET: heavy earth mover"
cap ren heavyvehicledrivingifyouenrollin f17g
cap lab var f17g "how interesting if enroll TVET: heavy vehicle drive"
cap ren jimzoifyouenrollinatvetinstituti f17h
cap lab var f17h "how interesting if enroll TVET: jimzo"
cap ren lhadriifyouenrollinatvetinstitut f17i
cap lab var f17i "how interesting if enroll TVET: lhadri"
cap ren masonryifyouenrollinatvetinstitu f17j
cap lab var f17j "how interesting if enroll TVET: masonry"
cap ren mechanicalfitterifyouenrollinatv f17k
cap lab var f17k "how interesting if enroll TVET: mechanics"
cap ren panelbeatingdentingandpantingify f17l
cap lab var f17l "how interesting if enroll TVET: panelbeating"
cap ren patrawoodcarvingifyouenrollinatv f17m
cap lab var f17m "how interesting if enroll TVET: patra"
cap ren plumbingifyouenrollinatvetinstit f17n
cap lab var f17n "how interesting if enroll TVET: plumbing"
cap ren v210 f17o
cap lab var f17o "how interesting if enroll TVET: transformer"
cap ren hotelortourismmanagementifyouenr f17p
cap lab var f17p "how interesting if enroll TVET: hotel, tourism"
cap ren foodproductionifyouenrollinatvet f17q
cap lab var f17q "how interesting if enroll TVET: food prod"
cap ren tailoringifyouenrollinatvetinsti f17r
cap lab var f17r "how interesting if enroll TVET: tailoring"


* Understand questions 
gen attentiveness = 1 if ifyouunderstandtheinstructioncle==2
lab var attentiveness "student understands the questions well"

* Self beliefs about population and own labor outcomes
cap ren bachelorsdegreesamongmenwhoareab g1a_m
cap lab var g1a_m "belief: pop employment with univ"
cap ren v470 g1b_m
cap lab var g1b_m "belief: pop employment with TTI"
cap ren stopeducationafterhighschoolamon g1c_m
cap lab var g1c_m "belief: pop employment with HS"

cap ren bachelorsdegreesamongthefulltime g2a_m
cap lab var g2a_m "belief: pop earnings with univ"
cap ren technicaltraininginstitutettiori g2b_m
cap lab var g2b_m "belief: pop earnings with TTI"
cap ren v474 g2c_m
cap lab var g2c_m "belief: pop earnings with HS"

cap ren bachelorsdegreesamongwomenwhoare g1a_f
cap lab var g1a_f "belief: pop employment with univ"
cap ren v476 g1b_f
cap lab var g1b_f "belief: pop employment with TTI"
cap ren v477 g1c_f
cap lab var g1c_f "belief: pop employment with HS"

cap ren v478 g2a_f
cap lab var g2a_f "belief: pop earnings with univ"
cap ren v479 g2b_f
cap lab var g2b_f "belief: pop earnings with TTI"
cap ren v480 g2c_f
cap lab var g2c_f "belief: pop earnings with HS"

cap ren bachelorsdegreescomparedtoallstu g3a
cap lab var g3a "belief: relative academic perf choosing univ"
cap ren v482 g3b
cap lab var g3b "belief: relative academic perf choosing TTI"
cap ren stopeducationafterhighschoolcomp g3c
cap lab var g3c "belief: relative academic perf choosing HS"

* Own labor market outcomes
cap ren bachelorsdegreeswhatdoyoubelieve g4a
cap lab var g4a "belief: own employment with univ"
cap ren v485 g4b
cap lab var g4b "belief: own employment with TTI"
cap ren v486 g4c
cap lab var g4c "belief: own employment with HS"

cap ren bachelorsdegreesimaginethatyouha g5a
cap lab var g5a "belief: own earnings with univ"
cap ren v488 g5b
cap lab var g5b "belief: own earnings with TTI"
cap ren stopeducationafterhighschoolimag g5c
cap lab var g5c "belief: own earnings with HS"

* Approval 
cap ren bachelorsdegreesimaginethatyouch g7a
cap ren v491 g7b
cap ren v492 g7c
cap lab var g7a "Approval of parents if choosing univ"
cap lab var g7b "Approval of parents if choosing TTI"
cap lab var g7c "Approval of parents if choosing HS"

cap ren v493 g8a
cap ren v494 g8b
cap ren v495 g8c
cap lab var g8a "Approval of friends if choosing univ"
cap lab var g8b "Approval of friends if choosing TTI"
cap lab var g8c "Approval of friends if choosing HS"

cap ren v496 g9a
cap ren v497 g9b
cap ren v498 g9c
cap lab var g9a "Approval of society if choosing univ"
cap lab var g9b "Approval of society if choosing TTI"
cap lab var g9c "Approval of society if choosing HS"

* Personalities 
cap ren isreservedhowmuchdoyouagreeordis p1a
cap ren tendstobelazyhowmuchdoyouagreeor p1b 
cap ren isoutgoingsociablehowmuchdoyouag p1c 
cap ren doesathoroughjobhowmuchdoyouagre p1d 
cap ren getsnervouseasilyhowmuchdoyouagr p1e 
cap ren hasanactiveimaginationhowmuchdoy p1f 
cap ren worriesalothowmuchdoyouagreeordi p1g 
cap ren remainscalmintensesituationshowm p1h 
cap ren istalkativehowmuchdoyouagreeordi p1i 
cap ren isoriginalcomesupwithnewideashow p1j 
cap ren valuesartisticaestheticexperienc p1k 
cap ren issometimesrudetoothershowmuchdo p1l 
cap ren hasaforgivingnaturehowmuchdoyoua p1m 
cap ren isconsiderateandkindtoalmostever p1n 
cap ren doesthingsefficientlyhowmuchdoyo p1o 

* Family background 
cap ren isyourfatheralive x1
cap lab var x1 "father alive"
cap ren doyoucurrentlylivewithyourfather x2
cap lab var x2 "living with father"
cap ren whatisthehighestlevelofeducation x3 
cap lab var x3 "father education"
cap ren whichofthefollowingbestdescribes x4
cap lab var x4 "father job"
cap ren inwhichsectordoesyourfatherwork x5
cap lab var x5 "father job industry"

cap ren isyourmotheralive x6
cap lab var x6 "mother alive"
cap ren doyoucurrentlylivewithyourmother x7
cap lab var x7 "living with mother"
cap ren v523 x8
cap lab var x8 "mother education"
cap ren v524 x9
cap lab var x9 "mother job"
cap ren inwhichsectordoesyourmotherwork x10
cap lab var x10 "mother job industry"

* Wealth
cap ren landplotdoyourparentsandotherhou x11a
cap lab var x11a "wealth: land plot"
cap ren housebuildingdoyourparentsandoth x11b
cap lab var x11b "wealth: house building"
cap ren vehiclenoncommercialdoyourparent x11c
cap lab var x11c "wealth: noncommercial vehicle"
cap ren motorcycledoyourparentsandotherh x11d
cap lab var x11d "wealth: motorcycle"
cap ren refrigeratordoyourparentsandothe x11e
cap lab var x11e "wealth: fridge"
cap ren washingmachinedoyourparentsandot x11f
cap lab var x11f "wealth: washing machine"
cap ren tvdoyourparentsandotherhousehold x11g
cap lab var x11g "wealth: tv"
cap ren mobilephonedoyourparentsandother x11h
cap lab var x11h "wealth: mobilephone"
cap ren computerdesktoporlaptopdoyourpar x11i
cap lab var x11i "wealth: computer"

* Siblings
cap ren howmanysiblingsdoyouhave x12
cap lab var x12 "siblings: total number"
cap destring x12, replace
cap ren howmanyofyoursiblingsarecurrentl x13a
cap lab var x13a "siblings: univ"
cap destring x13a, replace
cap ren v539 x13b
cap lab var x13b "siblings: TTI"
cap destring x13b, replace

* Relatives
cap ren howmanyofyourrelativesexcludingp x14a
cap lab var x14a "siblings: univ"
cap destring x14a, replace
cap ren v541 x14b
cap lab var x14b "siblings: TTI"
cap destring x14b, replace

* Friends
cap ren nameoffriendpleasewritedownthena y1a1
cap lab var y1a1 "friend 1: name"
cap ren v543 y1b1 
cap lab var y1b1 "friend 2: name"
cap ren v544 y1c1
cap lab var y1c1 "friend 3: name"
format y1*1 %30s

cap ren academicstreampleasewritedownthe y1a4
cap ren v546 y1b4
cap ren v547 y1c4
cap lab var y1a4 "friend 1: stream"
cap lab var y1b4 "friend 2: stream"
cap lab var y1c4 "friend 3: stream"

cap ren phonenumberpleasewritedownthenam y1a2
cap lab var y1a2 "friend 1: phone"
cap ren v549 y1b2
cap lab var y1b2 "friend 2: phone"
cap ren v550 y1c2
cap lab var y1c2 "friend 3: phone"
format y1*2 %10s

cap ren emailpleasewritedownthenamesofyo y1a3
cap lab var y1a3 "friend 1: email"
cap ren v552 y1b3
cap lab var y1b3 "friend 2: email"
cap ren v553 y1c3
cap lab var y1c3 "friend 3: email"
format y1*3 %30s

* Hobbies
cap ren listentomusichowmuchdoyoulikethe z1a
cap lab var z1a "hobby: listen to music" 
cap ren playmusichowmuchdoyoulikethefoll z1b 
cap lab var z1b "hobby: play music"
cap ren watchsportshowmuchdoyoulikethefo z1c
cap lab var z1c "hobby: watch sports"
cap ren playsportshowmuchdoyoulikethefol z1d
cap lab var z1d "hobby: play sports"
cap ren watchtvhowmuchdoyoulikethefollow z1e
cap lab var z1e "hobby: watch tv"
cap ren playvideoandonlinegameshowmuchdo z1f
cap lab var z1f "hobby: play videoonline games"

* Codes shared by Checku to correct school names
cap ren pleasespecifythenameofyoursecond other_school

foreach var of varlist other_school {
replace `var'= trim(itrim(lower(`var')))  // reduce multiple & consecutive blanks/make words into lower case
replace `var'= subinstr(`var'," ","",.)   //Removes spacing between words
replace `var'= subinstr(`var',",","",.)   //Removes comma (,)
replace `var'= subinstr(`var',"'","",.)   //Removes apostrophe (')
replace `var'= subinstr(`var',".","",.)   //Removes dot (.) 
replace `var'= subinstr(`var',"/","",.)   //Removes slash (/)
replace `var'= subinstr(`var',"-","",.)   //Removes dash (-)
replace `var'= subinstr(`var',"(","",.)   //Removes opening parentheses
replace `var'= subinstr(`var',")","",.)   //Removes closing parentheses
}

replace other_school="Baylling Central School" if regexm(other_school, "bayll")
replace other_school="Kengkhar Middle Secondary School" if regexm(other_school, "kengkhar")
replace other_school="Kidheykhar Central School" if regexm(other_school, "kid")
replace other_school="Minjiwoong Central School" if regexm(other_school,"minj")
replace other_school="Mongar Higher Secondary School" if regexm(other_school,"mongarh")

* School name variable
cap tostring schoolname, replace 
cap replace schoolname="" if schoolname=="."
forval i=16/38 {
	cap tostring v`i', replace
	cap replace v`i'="" if v`i'=="."
	cap replace schoolname=v`i' if (missing(schoolname)|schoolname=="Other (Specify)") & ~missing(v`i') & v`i'~="Other (Specify)"
}
cap replace schoolname = other_school if missing(schoolname) | schoolname=="Other (Specify)"

* Keep relevant variables 
keep responseid timestarted datesubmitted status name-schoolname stream studentid email email2 phone district_origin b1a-c3r c4 c5c1-f17r g1a_m-x4 x5 x6 x7 x8 x9 x10 x11a-z1f attentiveness

* save dataset 
save "$temp/grade1112_part2.dta", replace













********************************************************************************
*
*						 PILOT DATASETS 
*
********************************************************************************	

import delimited "$raw/student/grade1112/20210918121823-SurveyExport-Pilot.csv", clear

**************** DATA PROCESSING ***********************************************
* Personal information
cap ren whatisyourname name
cap ren whatisyourgender sex
replace sex=0 if sex==2
lab define sex 0 "Female" 1 "Male" 
lab val sex sex 
cap ren dzongkhagofyourschoolwhatisthena district
cap ren schoolwhatisthenameofyourhighsch schoolname
cap ren dateofbirthdaywhatisyourdateofbi b_day
cap ren dateofbirthmonthwhatisyourdateof b_month
cap ren dateofbirthyearwhatisyourdateofb b_year
cap ren whatisyourstudentidcode studentid
cap ren whatisyouremailaddressprovidedby email
cap ren whatisyourprivateemailaddress email2
cap ren whatisyourmobilephonenumber phone
cap ren whichdzongkhagareyouoriginallyfr district_origin
tostring district_origin, replace
replace district_origin="Bumthang" if district_origin=="1"
replace district_origin="Chukha" if district_origin=="2"
replace district_origin="Phuntsholing Thromde" if district_origin=="3"
replace district_origin="Dagana" if district_origin=="4"
replace district_origin="Gasa" if district_origin=="5"
replace district_origin="Haa" if district_origin=="6"
replace district_origin="Lhuentse" if district_origin=="7"
replace district_origin="Mongar" if district_origin=="8"
replace district_origin="Paro" if district_origin=="9"
replace district_origin="Pema Gatshel" if district_origin=="10"
replace district_origin="Punakha" if district_origin=="11"
replace district_origin="Samdrup Jongkhar" if district_origin=="12"
replace district_origin="Sarpang" if district_origin=="13"
replace district_origin="Gelephu Thromde" if district_origin=="14"
replace district_origin="Thimphu" if district_origin=="15"
replace district_origin="Trashigang" if district_origin=="16"
replace district_origin="Trashi Yangtse" if district_origin=="17"
replace district_origin="Tsirang" if district_origin=="18"
replace district_origin="Wandue Phodrang" if district_origin=="19"
replace district_origin="Zhemgang" if district_origin=="20"
replace district_origin="Abroad" if district_origin=="21"
cap ren whatisyouracademicstream stream 

* Perception about education and employment
cap ren itisimportantformetoreceiveeduca b1a
cap lab var b1a "perception: it's important to receive education"
cap ren educationhelpsmegetabetterjobhow b1c
cap lab var b1c "perception: education helps me get a better job"

cap ren scienceandtechnologyaremakingour b2a
cap lab var b2a "perception: science makes lives healthier, easier, comfortable"
cap ren allthingsconsideredscienceandtec b2d 
cap lab var b2d "perception: science makes the world better off"

* Academic performance
cap ren mathwhatisyouracademicperformanc c1a
cap lab var c1a "performance: math"
cap ren dzongkhawhatisyouracademicperfor c1b
cap lab var c1b "performance: dzongkha"
cap ren englishwhatisyouracademicperform c1c
cap lab var c1c "performance: english"
cap ren physicswhatisyouracademicperform c1d 
cap lab var c1d "performance: physics"
cap ren chemistrywhatisyouracademicperfo c1e
cap lab var c1e "performance: chemistry"
cap ren biologywhatisyouracademicperform c1f
cap lab var c1f "performance: biology"
cap ren economicswhatisyouracademicperfo c1g
cap lab var c1g "performance: economics"
cap ren geographywhatisyouracademicperfo c1h
cap lab var c1h "performance: geography"
cap ren historywhatisyouracademicperform c1i
cap lab var c1i "performance: history"
cap ren ictwhatisyouracademicperformance c1j
cap lab var c1j "performance: ICT"
cap ren overallwhatisyouracademicperform c1k
cap lab var c1k "performance: overall"

* TVET courses in high school
cap ren haveyoutakenanytvetoptionalcours c2
cap lab var c2 "taken any TVET optional course?"
cap lab def tvet 1 "Yes" 2 "No"
cap lab val c2 tvet

cap ren animationwhichtvetoptionalcourse c3a
cap lab var c3a "tvet course taken: animation"
cap ren automobilemechanicwhichtvetoptio c3b 
cap lab var c3b "tvet course taken: automobile mechanic"
cap ren computerhardwareandnetworkingwhi c3c
cap lab var c3c "tvet course taken: computer hardware, networking"
cap ren electricalwhichtvetoptionalcours c3d
cap lab var c3d "tvet course taken: electrical"
cap ren furnituremakingwhichtvetoptional c3e
cap lab var c3e "tvet course taken: furniture"
cap ren heavyearthmoverwhichtvetoptional c3f
cap lab var c3f "tvet course taken: heavy earth mover"
cap ren heavyvehicledrivingwhichtvetopti c3g
cap lab var c3g "tvet course taken: heavy vehicle driving"
cap ren jimzowhichtvetoptionalcoursehave c3h
cap lab var c3h "tvet course taken: jimzo"
cap ren lhadriwhichtvetoptionalcoursehav c3i
cap lab var c3i "tvet course taken: lhadri"
cap ren masonrywhichtvetoptionalcourseha c3j
cap lab var c3j "tvet course taken: masonry"
cap ren mechanicalfitterwhichtvetoptiona c3k
cap lab var c3k "tvet course taken: mechanical fitter"
cap ren panelbeatingdentingandpantingwhi c3l
cap lab var c3l "tvet course taken: panel beating"
cap ren patrawoodcarvingwhichtvetoptiona c3m
cap lab var c3m "tvet course taken: patra"
cap ren plumbingwhichtvetoptionalcourseh c3n
cap lab var c3n "tvet course taken: plumbing"
cap ren repairmaintenanceandcommissionin c3o
cap lab var c3o "tvet course taken: repair, maintenance"
cap ren hotelortourismmanagementwhichtve c3p
cap lab var c3p "tvet course taken: hotel, tourism management"
cap ren foodproductionwhichtvetoptionalc c3q
cap lab var c3q "tvet course taken: food production"
cap ren tailoringwhichtvetoptionalcourse c3r
cap lab var c3r "tvet course taken: tailoring"

cap ren whydidyounotchoosetotaketvetopti c4
cap lab var c4 "reason not taking tvet course"

* Mentoring
cap ren parentsdoyoutalktoaboutyourcaree c5c1
cap lab var c5c1 "mentoring: parents"
cap ren v87 c5c2
cap lab var c5c2 "mentoring: siblings"
cap ren v88 c5c3
cap lab var c5c3 "mentoring: relatives"
cap ren friendsdoyoutalktoaboutyourcaree c5c4
cap lab var c5c4 "mentoring: friends"
cap ren neighborsdoyoutalktoaboutyourcar c5c5
cap lab var c5c5 "mentoring: neighbors" 
cap ren v91 c5c6
cap lab var c5c6 "mentoring: teachers school counselors"
cap ren othersdoyoutalktoaboutyourcareer c5c7 
cap lab var c5c7 "mentoring: others"

forval i=1/7 {
	cap replace c5c`i'="1" if ~missing(c5c`i')
	destring c5c`i', replace
	cap replace c5c`i'=0 if c5c`i'==.
}

* Education plans
cap ren iftherewerenobarriershowfarinsch c7
cap lab var c7 "education plan if no barriers"
cap ren asthingsstandnowhowfarinschooldo c8 
cap lab var c8 "education plan as things stand now"

* Preference about employment 
cap ren incomeforyourfutureeducationalan d1a
cap lab var d1a "importance to educareer: income"
cap ren prestigeandsocialstatusforyourfu d1c
cap lab var d1c "importance to educareer: prestige"
cap ren mygenuineinterestforyourfutureed d1d
cap lab var d1d "importance to educareer: genuine interest"
cap ren advicefromparentsorguardiansfory d1f
cap lab var d1f "importance to educareer: parents advice"
cap ren whatmyfriendsthinkandchooseforyo d1g
cap lab var d1g "importance to educareer: friends choice"
cap ren goodbalancebetweenprofessionalan d1h
cap lab var d1h "importance to educareer: worklife balance"
cap ren costsofeducationforyourfutureedu d1i
cap lab var d1i "importance to educareer: costedu"

cap ren agricultureforestryandfishingwhi d2a
cap lab var d2a "ranking perferred sector: agriculture"
cap ren miningwhichsectorswouldyouprefer d2b
cap lab var d2b "ranking perferred sector: mining"
cap ren manufacturingwhichsectorswouldyo d2c
cap lab var d2c "ranking perferred sector: manufacturing"
cap ren electricitygaswatersupplywastema d2d
cap lab var d2d "ranking perferred sector: public utilities"
cap ren constructionwhichsectorswouldyou d2e
cap lab var d2e "ranking perferred sector: construction"
cap ren retailwholesaletradingwhichsecto d2f
cap lab var d2f "ranking perferred sector: trade"
cap ren hotelrestaurantfoodserviceswhich d2g
cap lab var d2g "ranking perferred sector: hotel, food"
cap ren transportationwhichsectorswouldy d2h
cap lab var d2h "ranking perferred sector: transportation"
cap ren informationandcommunicationwhich d2i
cap lab var d2i "ranking perferred sector: ict"
cap ren financialandinsuranceactivitiesw d2j
cap lab var d2j "ranking perferred sector: finance"
cap ren educationwhichsectorswouldyoupre d2k
cap lab var d2k "ranking perferred sector: education"
cap ren healthwhichsectorswouldyouprefer d2l
cap lab var d2l "ranking perferred sector: health"
cap ren entertainmentartsrecreationwhich d2m
cap lab var d2m "ranking perferred sector: entertainment"
cap ren professionalscientificandtechnic d2n
cap lab var d2n "ranking perferred sector: science"

cap ren governmentwhichofthefollowingemp d3a
cap lab var d3a "ranking preferred employer: government"
cap ren governmentownedcorporationwhicho d3b
cap lab var d3b "ranking preferred employer: soe"
cap ren privatecompanywhichofthefollowin d3c
cap lab var d3c "ranking preferred employer: private"
cap ren runningnonfarmingbusinesswhichof d3d
cap lab var d3d "ranking preferred employer: own nonfarm"
cap ren farmingwhichofthefollowingemploy d3e
cap lab var d3e "ranking preferred employer: own farm"

cap ren iknowexactlywhichoccupationiwant d4a
cap lab var d4a "perception: know exactly which occupation to work"
cap ren bluecollarjobsarepoorlyperceived d4c
cap lab var d4c "perception: blue-collar jobs are poorly perceived in society"
cap ren bluecollarjobsareinferiortowhite d4d
cap lab var d4d "perception: blue-collar jobs are inferior to white collars"
cap ren evenwithgoodpayiwouldnttakebluec d4e
cap lab var d4e "perception: even with good pay, not take blue-collar jobs"
cap ren bluecollarjobsareformenrathertha d4g
cap lab var d4g "perception: blue-collar jobs are for men than women"

* Knowledge about university education and TVET education
cap ren universityeducationhowmuchdoyoua f1a
cap lab var f1a "knowledge: admission criteria to university"
cap ren tveteducationbytechnicaltraining f1b
cap lab var f1b "knowledge: admission criteria to tvet"

cap ren v138 f2a
cap lab var f2a "knowledge: application to university"
cap ren v139 f2b
cap lab var f2b "knowledge: application to tvet"

cap ren v140 f3a
cap lab var f3a "knowledge: curriculum of university"
cap ren v141 f3b
cap lab var f3b "knowledge: curriculum of tvet"

cap ren v142 f4a
cap lab var f4a "knowledge: student life at university"
cap ren v143 f4b
cap lab var f4b "knowledge: student life at tvet"

cap ren v144 f5a
cap lab var f5a "knowledge: tuition scholarship university"
cap ren v145 f5b
cap lab var f5b "knowledge: tuition scholarship tvet"

cap ren v146 f6a
cap lab var f6a "knowledge: graduation rate of university"
cap ren v147 f6b
cap lab var f6b "knowledge: graduation rate of tvet"

cap ren v148 f7a
cap lab var f7a "knowledge: future career of university"
cap ren v149 f7b
cap lab var f7b "knowledge: future career of tvet"

cap ren v150 f8a
cap lab var f8a "knowledge: overall university"
cap ren v151 f8b
cap lab var f8b "knowledge: overall tvet"


* Degree ranking by genuine interest 
cap ren bachelorssciencemathcomputerscie f9a
cap lab var f9a "ranking: SCI"
cap tostring f9a, replace 
cap ren bachelorsengineeringpleaserankth f9b
cap lab var f9b "ranking: ENG"
cap tostring f9b, replace 
cap ren bachelorsmedicinehealthandnursin f9c
cap lab var f9c "ranking: MED"
cap tostring f9c, replace 
cap ren bachelorseducationpleaserankthef f9d
cap lab var f9d "ranking: EDU"
cap tostring f9d, replace 
cap ren bachelorsbusinessmanagementecono f9e
cap lab var f9e "ranking: BUS"
cap tostring f9e, replace 
cap ren bachelorsartshumanitiesandsocial f9f
cap lab var f9f "ranking: ARTS"
cap tostring f9f, replace 
cap ren technicaldegreesnationalcertific f9g
cap lab var f9g "ranking: TTI"
cap tostring f9g, replace 
cap ren stopeducationafterhighschoolplea f9h
cap lab var f9h "ranking: HighSchool"
cap tostring f9h, replace 

* Based on academic performance, how difficult to enroll/complete
cap ren bachelorsdegreesbasedonyouracade f10a
cap lab var f10a "how difficult to enroll in university"
cap ren v161 f10b
cap lab var f10b "how difficult to enroll in tvet"

cap ren bachelorsdegreeshoweasyordifficu f11a
cap lab var f11a "how difficult to complete university"
cap ren v163 f11b
cap lab var f11b "how difficult to complete tvet"

cap ren bachelorsdegreeshowmuchdoyouthin f12a
cap lab var f12a "how much to enjoy curriculum of university"
cap ren v165 f12b
cap lab var f12b "how much to enjoy curriculum of tvet"

cap ren v166 f13a
cap lab var f13a "how much to enjoy student life of university"
cap ren v167 f13b
cap lab var f13b "how much to enjoy student life of tvet"

* Decision today 
cap ren v168 f14a 
cap lab var f14a "decision ranking: SCI"
cap ren bachelorsengineeringifyoutodayde f14b
cap lab var f14b "decision ranking: ENG"
cap ren v170 f14c
cap lab var f14c "decision ranking: MED"
cap ren bachelorseducationifyoutodaydeci f14d
cap lab var f14d "decision ranking: EDU"
cap ren v172 f14e
cap lab var f14e "decision ranking: BUS"
cap ren v173 f14f
cap lab var f14f "decision ranking: ARTS"
cap ren v174 f14g
cap lab var f14g "decision ranking: TTI"
cap ren stopeducationafterhighschoolifyo f14h
cap lab var f14h "decision ranking: HS"

* Sure about f14?
cap ren howsureareyouaboutyourchoicesand f15
cap lab var f15 "How sure about f14"

* Understand questions 
gen attentiveness = 1 if ifyouunderstandtheinstructioncle==2
lab var attentiveness "student understands the questions well"

*  Beliefs about % of other students choice
cap ren v177 f16a_m
cap lab var f16a_m "belief: % male students choosing SCI"
cap ren bachelorsengineeringwhatpercenta f16b_m
cap lab var f16b_m "belief: % male students choosing ENG"
cap ren v179 f16c_m
cap lab var f16c_m "belief: % male students choosing MED"
cap ren bachelorseducationwhatpercentage f16d_m
cap lab var f16d_m "belief: % male students choosing EDU"
cap ren v181 f16e_m
cap lab var f16e_m "belief: % male students choosing BUS"
cap ren v182 f16f_m
cap lab var f16f_m "belief: % male students choosing ARTS"
cap ren v183 f16g_m
cap lab var f16g_m "belief: % male students choosing TTI"
cap ren stopeducationafterhighschoolwhat f16h_m
cap lab var f16h_m "belief: % male students choosing HS"

cap ren v185 f16a_f
cap lab var f16a_f "belief: % female students choosing SCI"
cap ren v186 f16b_f
cap lab var f16b_f "belief: % female students choosing ENG"
cap ren v187 f16c_f
cap lab var f16c_f "belief: % female students choosing MED"
cap ren v188 f16d_f
cap lab var f16d_f "belief: % female students choosing EDU"
cap ren v189 f16e_f
cap lab var f16e_f "belief: % female students choosing BUS"
cap ren v190 f16f_f
cap lab var f16f_f "belief: % female students choosing ARTS"
cap ren v191 f16g_f
cap lab var f16g_f "belief: % female students choosing TTI"
cap ren v192 f16h_f
cap lab var f16h_f "belief: % female students choosing HS"

* TVET courses 
cap ren animationifyouenrollinatvetinsti f17a
cap lab var f17a "how interesting if enroll TVET: animation"
cap ren automobilemechanicifyouenrollina f17b 
cap lab var f17b "how interesting if enroll TVET: automobile"
cap ren computerhardwareandnetworkingify f17c 
cap lab var f17c "how interesting if enroll TVET: computer"
cap ren electricalifyouenrollinatvetinst f17d
cap lab var f17d "how interesting if enroll TVET: electrics"
cap ren furnituremakingifyouenrollinatve f17e
cap lab var f17e "how interesting if enroll TVET: furniture"
cap ren heavyearthmoverifyouenrollinatve f17f
cap lab var f17f "how interesting if enroll TVET: heavy earth mover"
cap ren heavyvehicledrivingifyouenrollin f17g
cap lab var f17g "how interesting if enroll TVET: heavy vehicle drive"
cap ren jimzoifyouenrollinatvetinstituti f17h
cap lab var f17h "how interesting if enroll TVET: jimzo"
cap ren lhadriifyouenrollinatvetinstitut f17i
cap lab var f17i "how interesting if enroll TVET: lhadri"
cap ren masonryifyouenrollinatvetinstitu f17j
cap lab var f17j "how interesting if enroll TVET: masonry"
cap ren mechanicalfitterifyouenrollinatv f17k
cap lab var f17k "how interesting if enroll TVET: mechanics"
cap ren panelbeatingdentingandpantingify f17l
cap lab var f17l "how interesting if enroll TVET: panelbeating"
cap ren patrawoodcarvingifyouenrollinatv f17m
cap lab var f17m "how interesting if enroll TVET: patra"
cap ren plumbingifyouenrollinatvetinstit f17n
cap lab var f17n "how interesting if enroll TVET: plumbing"
cap ren v207 f17o
cap lab var f17o "how interesting if enroll TVET: transformer"
cap ren hotelortourismmanagementifyouenr f17p
cap lab var f17p "how interesting if enroll TVET: hotel, tourism"
cap ren foodproductionifyouenrollinatvet f17q
cap lab var f17q "how interesting if enroll TVET: food prod"
cap ren tailoringifyouenrollinatvetinsti f17r
cap lab var f17r "how interesting if enroll TVET: tailoring"

* Self beliefs about population and own labor outcomes
cap ren bachelorsdegreesamongmenwhoareab g1a_m
cap lab var g1a_m "belief: pop employment with univ"
cap ren v258 g1b_m
cap lab var g1b_m "belief: pop employment with TTI"
cap ren stopeducationafterhighschoolamon g1c_m
cap lab var g1c_m "belief: pop employment with HS"

cap ren bachelorsdegreesamongthefulltime g2a_m
cap lab var g2a_m "belief: pop earnings with univ"
cap ren technicaltraininginstitutettiori g2b_m
cap lab var g2b_m "belief: pop earnings with TTI"
cap ren v262 g2c_m
cap lab var g2c_m "belief: pop earnings with HS"

cap ren bachelorsdegreesamongwomenwhoare g1a_f
cap lab var g1a_f "belief: pop employment with univ"
cap ren v264 g1b_f
cap lab var g1b_f "belief: pop employment with TTI"
cap ren v265 g1c_f
cap lab var g1c_f "belief: pop employment with HS"

cap ren v266 g2a_f
cap lab var g2a_f "belief: pop earnings with univ"
cap ren v267 g2b_f
cap lab var g2b_f "belief: pop earnings with TTI"
cap ren v268 g2c_f
cap lab var g2c_f "belief: pop earnings with HS"

cap ren bachelorsdegreescomparedtoallstu g3a
cap lab var g3a "belief: relative academic perf choosing univ"
cap ren v270 g3b
cap lab var g3b "belief: relative academic perf choosing TTI"
cap ren stopeducationafterhighschoolcomp g3c
cap lab var g3c "belief: relative academic perf choosing HS"

* Own labor market outcomes
cap ren bachelorsdegreeswhatdoyoubelieve g4a
cap lab var g4a "belief: own employment with univ"
cap ren v273 g4b
cap lab var g4b "belief: own employment with TTI"
cap ren v274 g4c
cap lab var g4c "belief: own employment with HS"

cap ren bachelorsdegreesimaginethatyouha g5a
cap lab var g5a "belief: own earnings with univ"
cap ren v276 g5b
cap lab var g5b "belief: own earnings with TTI"
cap ren stopeducationafterhighschoolimag g5c
cap lab var g5c "belief: own earnings with HS"

* Approval 
cap ren bachelorsdegreesimaginethatyouch g7a
cap ren v282 g7b
cap ren v283 g7c
cap lab var g7a "Approval of parents if choosing univ"
cap lab var g7b "Approval of parents if choosing TTI"
cap lab var g7c "Approval of parents if choosing HS"

cap ren v284 g8a
cap ren v285 g8b
cap ren v286 g8c
cap lab var g8a "Approval of friends if choosing univ"
cap lab var g8b "Approval of friends if choosing TTI"
cap lab var g8c "Approval of friends if choosing HS"

cap ren v287 g9a
cap ren v288 g9b
cap ren v289 g9c
cap lab var g9a "Approval of society if choosing univ"
cap lab var g9b "Approval of society if choosing TTI"
cap lab var g9c "Approval of society if choosing HS"

* Personalities 
cap ren isreservedhowmuchdoyouagreeordis p1a
cap ren tendstobelazyhowmuchdoyouagreeor p1b 
cap ren isoutgoingsociablehowmuchdoyouag p1c 
cap ren doesathoroughjobhowmuchdoyouagre p1d 
cap ren getsnervouseasilyhowmuchdoyouagr p1e 
cap ren hasanactiveimaginationhowmuchdoy p1f 
cap ren worriesalothowmuchdoyouagreeordi p1g 
cap ren remainscalmintensesituationshowm p1h 
cap ren istalkativehowmuchdoyouagreeordi p1i 
cap ren isoriginalcomesupwithnewideashow p1j 
cap ren valuesartisticaestheticexperienc p1k 
cap ren issometimesrudetoothershowmuchdo p1l 
cap ren hasaforgivingnaturehowmuchdoyoua p1m 
cap ren isconsiderateandkindtoalmostever p1n 
cap ren doesthingsefficientlyhowmuchdoyo p1o 

* Family background 
cap ren isyourfatheralive x1
cap lab var x1 "father alive"
cap ren doyoucurrentlylivewithyourfather x2
cap lab var x2 "living with father"
cap ren whatisthehighestlevelofeducation x3 
cap lab var x3 "father education"
cap ren whichofthefollowingthebasedescri x4
cap lab var x4 "father job"
cap ren inwhichsectordoesyourfatherwork x5
cap lab var x5 "father job industry"

cap ren isyourmotheralive x6
cap lab var x6 "mother alive"
cap ren doyoucurrentlylivewithyourmother x7
cap lab var x7 "living with mother"
cap ren v315 x8
cap lab var x8 "mother education"
cap ren v316 x9
cap lab var x9 "mother job"
cap ren inwhichsectordoesyourmotherwork x10
cap lab var x10 "mother job industry"

* Wealth
cap ren landplotdoyourparentsandotherhou x11a
cap lab var x11a "wealth: land plot"
cap ren housebuildingdoyourparentsandoth x11b
cap lab var x11b "wealth: house building"
cap ren vehiclenoncommercialdoyourparent x11c
cap lab var x11c "wealth: noncommercial vehicle"
cap ren motorcycledoyourparentsandotherh x11d
cap lab var x11d "wealth: motorcycle"
cap ren refrigeratordoyourparentsandothe x11e
cap lab var x11e "wealth: fridge"
cap ren washingmachinedoyourparentsandot x11f
cap lab var x11f "wealth: washing machine"
cap ren tvdoyourparentsandotherhousehold x11g
cap lab var x11g "wealth: tv"
cap ren mobilephonedoyourparentsandother x11h
cap lab var x11h "wealth: mobilephone"
cap ren computerdesktoporlaptopdoyourpar x11i
cap lab var x11i "wealth: computer"

* Siblings
cap ren howmanysiblingsdoyouhave x12
cap lab var x12 "siblings: total number"
cap destring x12, replace
cap ren howmanyofyoursiblingsarecurrentl x13a
cap lab var x13a "siblings: univ"
cap destring x13a, replace
cap ren v331 x13b
cap lab var x13b "siblings: TTI"
cap destring x13b, replace

* Relatives
cap ren howmanyofyourrelativesexcludingp x14a
cap lab var x14a "siblings: univ"
cap destring x14a, replace
cap ren v333 x14b
cap lab var x14b "siblings: TTI"
cap destring x14b, replace

* Friends
cap ren nameoffriendpleasewritedownthena y1a1
cap lab var y1a1 "friend 1: name"
cap ren v335 y1b1 
cap lab var y1b1 "friend 2: name"
cap ren v336 y1c1
cap lab var y1c1 "friend 3: name"
format y1*1 %30s

cap ren academicstreampleasewritedownthe y1a4
cap ren v338 y1b4
cap ren v339 y1c4
cap lab var y1a4 "friend 1: stream"
cap lab var y1b4 "friend 2: stream"
cap lab var y1c4 "friend 3: stream"

cap ren phonenumberpleasewritedownthenam y1a2
cap lab var y1a2 "friend 1: phone"
cap ren v341 y1b2
cap lab var y1b2 "friend 2: phone"
cap ren v342 y1c2
cap lab var y1c2 "friend 3: phone"
format y1*2 %10s

cap ren emailpleasewritedownthenamesofyo y1a3
cap lab var y1a3 "friend 1: email"
cap ren v344 y1b3
cap lab var y1b3 "friend 2: email"
cap ren v345 y1c3
cap lab var y1c3 "friend 3: email"
format y1*3 %30s

* Hobbies
cap ren listentomusichowmuchdoyoulikethe z1a
cap lab var z1a "hobby: listen to music" 
cap ren playmusichowmuchdoyoulikethefoll z1b 
cap lab var z1b "hobby: play music"
cap ren watchsportshowmuchdoyoulikethefo z1c
cap lab var z1c "hobby: watch sports"
cap ren playsportshowmuchdoyoulikethefol z1d
cap lab var z1d "hobby: play sports"
cap ren watchtvhowmuchdoyoulikethefollow z1e
cap lab var z1e "hobby: watch tv"
cap ren playvideoandonlinegameshowmuchdo z1f
cap lab var z1f "hobby: play videoonline games"

* Keep relevant variables 
keep responseid timestarted datesubmitted status name-schoolname stream studentid email email2 phone district_origin b1a b1c b2a b2d c1a-c3r c4 c5c1-c5c7 c7 c8 d1f-d3e d4* f1a-f17r g1a_m-g5c g7a-g9c p1* x1-x4 x5 x6-x9 x10 x11a-z1f attentiveness

* 2 observations did not answer the correct school names
replace schoolname="SonamThang Central School"
replace district="Zhemgang"

* save dataset 
save "$temp/grade1112_part3.dta", replace



********************************************************************************
clear
append using "$temp/grade1112_part1.dta"
g part=1
append using "$temp/grade1112_part2.dta"
replace part=2 if part==.
append using "$temp/grade1112_part3.dta"
replace part=3 if part==.


********** check if student observations are unique 
* duplicated submissions: based on studentid name b_day b_moth b_year
* keep the earliest submissions
duplicates tag studentid name b_day b_month b_year, g(dupsubmission)
sort studentid name b_day b_month b_year timestarted
g double surveytime =clock(timestarted, "MDY hms")
format surveytime %15.0f
bys studentid name b_day b_month b_year: egen double min=min(surveytime)
drop if min~=surveytime & dupsubmission~=0

drop min dupsubmission

* duplicated studentid
duplicates tag studentid, g(temp)
drop if temp~=0

* Change name to lower cases 
cap replace name=strlower(name)
cap replace name=subinstr(name,".","",.)   //Removes dot (.) 
cap replace name=subinstr(name,"  "," ",.)   //Removes double spaces
cap replace name=subinstr(name,"my name is ","",.)   //Removes my name is (.) 
cap replace name=subinstr(name,"my is ","",.)   //Removes my name is (.) 
cap replace name=subinstr(name,"my good name is ","",.) 
cap replace schoolname=subinstr(schoolname,"  "," ",.)
cap replace schoolname=strlower(schoolname)
cap replace schoolname=subinstr(schoolname, "school ", "school",.)
cap replace schoolname=subinstr(schoolname, "schooll", "school",.)
format name %30s
format schoolname %40s

drop if name=="test" | name==""
drop temp

* correct school names
replace schoolname="mongar higher secondary school" if schoolname=="mongar mss"
replace schoolname="chokhorling middle secondary school" if schoolname=="choekhorling middle secondary school"
replace schoolname="gelephu higher secondary school" if schoolname=="gelephu higher secondary"
replace schoolname="phuentshothang higher secondary school" if schoolname=="phuentshothanghighersecondaryschool" 
replace schoolname="phuentsholing higher secondary school" if schoolname=="phuentsholing middle secondary school"
replace schoolname="shari higher secondary school" if schoolname=="shari hugher secondary school"
replace schoolname="sarpang central school" if schoolname=="sarpang higher secondary school" | schoolname=="sarpang middle secondary school"
replace schoolname="tangmachu central school" if schoolname=="tangmachucentralschool"
replace schoolname="nima higher secondary school" if schoolname=="nima higher secondary shool"
cap replace schoolname="dr tobgyel school" if schoolname=="dr. tobgyel school"

* correct district names 
rename district district_survey
merge m:1 schoolname using "$clean/list_of_schools.dta"
order district, b(district_survey)

tab schoolname if _merge==1
replace schoolname="" if _merge==1

drop if _merge==2
drop _merge 

sort part responseid schoolname

* Correct schoolname using studentid (waiting for attendance sheet from Cheku)
unique studentid if schoolname==""
* 353 missing schoolname with unique studentid

* revalue variables (2 to 0 for yes/no question)
recode c2 c3* x1 x2 x6 x7 x11* (2=0)

save "$temp/grade1112_baseline.dta", replace



*******************************************************************************
****** merge with grade information from list of student
* retrieve schoolname 
use "$temp/grade1112_baseline.dta", clear 

preserve 
drop if missing(schoolname)
save "$clean/all_grade1112_baseline.dta", replace 
restore 

keep if missing(schoolname)
merge 1:m studentid using "$temp/list_of_students"
keep if _merge==3
keep studentid schoolname2 grade responseid
rename grade grade0
duplicates drop studentid responseid, force
save "$temp/grade1112_baseline_part0.dta", replace

* matchID = studentid and schoolname 
use "$temp/list_of_students", clear
keep if inlist(grade, 11, 12)
rename schoolname2 schoolname 
unique studentid schoolname
merge 1:1 studentid schoolname using "$temp/grade1112_baseline.dta"
drop stream2

preserve 
keep if _merge==3
keep studentid schoolname grade responseid
rename grade grade1
save "$temp/grade1112_baseline_part1.dta", replace
restore 

* matchID = studentid 
preserve
drop if _merge==3 | _merge==2
keep studentid name2 grade schoolname 
duplicates tag studentid, g(temp)
list name2 schoolname if temp~=0
drop if temp~=0
rename schoolname schoolname2 

merge 1:1 studentid using "$temp/grade1112_baseline.dta"
keep if _merge==3
drop schoolname 
rename schoolname2 schoolname 
keep studentid schoolname grade responseid
rename grade grade2
save "$temp/grade1112_baseline_part2.dta", replace
restore 

* determine grade based on responseid for the remaining observations 
use "$temp/grade1112_baseline.dta", clear 
merge 1:1 responseid studentid using "$temp/grade1112_baseline_part0.dta"
replace schoolname=schoolname2 if missing(schoolname)
drop schoolname2
rename _merge m0
merge 1:1 responseid studentid using "$temp/grade1112_baseline_part1.dta"
rename _merge m1
merge 1:1 responseid studentid using "$temp/grade1112_baseline_part2.dta"
rename _merge m2

egen grade=rowmax(grade0 grade1 grade2)
drop grade0 grade1 grade2 
br schoolname responseid studentid grade part
format studentid %20s
sort schoolname responseid part

g grade_list = grade 

forval i=1/50 {
replace grade=grade[_n-1] if grade[_n-1]==grade[_n+1] & int(responseid/1000)==int(responseid[_n-1]/1000) & int(responseid/1000)==int(responseid[_n+1]/1000) & schoolname==schoolname[_n-1] & schoolname==schoolname[_n+1] & part==part[_n-1] & part==part[_n+1] & grade==. 

replace grade=grade[_n-1] if grade[_n-1]==grade[_n+2] & int(responseid/1000)==int(responseid[_n-1]/1000) & int(responseid/1000)==int(responseid[_n+2]/1000) & schoolname==schoolname[_n-1] & schoolname==schoolname[_n+2] & part==part[_n-1] & part==part[_n+2] & grade==. 

replace grade=grade[_n-2] if grade[_n-2]==grade[_n+1] & int(responseid/1000)==int(responseid[_n-2]/1000) & int(responseid/1000)==int(responseid[_n+1]/1000) & schoolname==schoolname[_n-2] & schoolname==schoolname[_n+1] & part==part[_n-2] & part==part[_n+1] & grade==. 

}

* save as new dataset 
save "$temp/grade1112_baseline_wgrade.dta", replace 


*******************************************************************************
***** merge with grade information from minjiwoong school 
use "$temp/grade1112_baseline.dta", clear
keep if schoolname=="minjiwoong central school"
duplicates drop name, force
tempfile minjiwoong
save `minjiwoong', replace

use "$temp/list_minjiwoong central school.dta", clear
keep if inlist(grade, 11, 12)
drop stream2
duplicates drop name2, force 
rename name2 name 
merge 1:1 name using `minjiwoong'

preserve 
keep if _merge==3 
drop _merge schoolname2 
keep studentid grade responseid
g grade_list = grade 
save "$temp/grade1112_baseline_minjiwoong_p1", replace 
restore

keep if _merge~=3
sort name 
g grade_list = grade 
replace grade=11 if inlist(responseid, 7526, 13990, 14279, 13804, 7514, 3676, 4115, 7505, 7463, 4113, 7247, 7490) & grade==.
replace grade=12 if inlist(responseid, 7573, 4083, 22072, 13789, 4047, 7571, 4095, 4052, 4404 ) & grade==.

keep if responseid~=.
sort responseid
keep studentid grade grade_list responseid
save "$temp/grade1112_baseline_minjiwoong_p2", replace 

* determine grade based on responseid for the remaining observations 
use "$temp/grade1112_baseline.dta", clear
keep if schoolname=="minjiwoong central school"
merge 1:1 responseid using "$temp/grade1112_baseline_minjiwoong_p1"
rename _merge m1
merge 1:1 responseid using "$temp/grade1112_baseline_minjiwoong_p2"
rename _merge m2

br responseid name grade grade_list

save "$temp/grade1112_baseline_minjiwoong.dta", replace 


*******************************************************************************
***** merge with grade information from damphu school 
use "$temp/grade1112_baseline.dta", clear
keep if schoolname=="damphu central school"
duplicates drop name, force
tempfile damphu
save `damphu', replace

use "$temp/list_damphu central school.dta", clear
keep if inlist(grade, 11, 12)
drop stream2
duplicates drop name2, force 
rename name2 name 
merge 1:1 name using `damphu'

preserve 
keep if _merge==3 
drop _merge schoolname2 
keep studentid grade responseid
g grade_list = grade 
save "$temp/grade1112_baseline_damphu_p1", replace 
restore

keep if _merge~=3
sort name
* compare name to retrieve grade 
g grade_list = grade 

replace grade=11 if inlist(responseid, 33459, 9545, 32779, 17981, 20054, 32932) & grade==.
replace grade=11 if inlist(responseid, 17987, 32919, 32482, 13924, 18160, 11655) & grade==.
replace grade=11 if inlist(responseid, 16941, 13785, 9723, 9670, 24308, 14801, 33764, 20028, 24301 ) & grade==.
replace grade=11 if inlist(responseid, 33405, 24365, 32421, 20040, 24244, 33879 ) & grade==.

replace grade=12 if inlist(responseid, 20763, 26267, 20593, 32893, 33341, 22521) & grade==.
replace grade=12 if inlist(responseid, 15224, 15228, 22288, 32318, 22703) & grade==.
replace grade=12 if inlist(responseid, 32420, 32586, 32864, 22696, 32905) & grade==.
replace grade=12 if inlist(responseid, 22768, 22695, 32913, 25137, 32811, 18002) & grade==.

drop if name=="damphu central school"

keep if responseid~=.

keep studentid grade grade_list responseid
save "$temp/grade1112_baseline_damphu_p2", replace 

* determine grade based on responseid for the remaining observations 
use "$temp/grade1112_baseline.dta", clear
keep if schoolname=="damphu central school"
merge 1:1 responseid using "$temp/grade1112_baseline_damphu_p1"
rename _merge m1
merge 1:1 responseid using "$temp/grade1112_baseline_damphu_p2"
rename _merge m2

br responseid name grade* 
save "$temp/grade1112_baseline_damphu.dta", replace 

*******************************************************************************
* put data together 
use "$temp/grade1112_baseline_wgrade.dta", clear 
drop if schoolname=="damphu central school" | schoolname=="minjiwoong central school"
append using "$temp/grade1112_baseline_damphu.dta"
append using "$temp/grade1112_baseline_minjiwoong.dta" 
drop m0 m1 m2

replace grade=11 if (responseid==16181 & schoolname=="druk school") | (inlist(responseid, 27961, 27808) & schoolname=="punakha central school")
save "$clean/grade1112_baseline_wgrade.dta", replace

* FOR reachable schools
keep if dn_tti~=.

save "$clean/grade1112_baseline_reachable_wgrade.dta", replace

global tempfilelist: dir "$temp/" files "grade1112_*.dta"
	foreach tfile of global tempfilelist {
	erase "$temp/`tfile'"
}